Forum Discussion

Lukmanayahayya's avatar
Lukmanayahayya
Copper Contributor
Oct 12, 2022

Limiting Spin Button and Printing All

Hello Everyone! 


There's this file I'm working on that I need help on. 

The two challenges I face now are:
1. The spin buttons I am using usually go beyond their limit and end up spinning to blank cells. I want to be able to limit the spinning to the last item in the list.
Address = Sheet(REPORT), Cell J232.
It should not spin beyond the last entry (Zainab Ibrahim Usman of SS1 Gold).
2. There is a button I made that prints the report card of a selectes student. I don't know whether its possible to create a macro button that will print all the students in a class in one click.
I want it to be whenever I click the button (Ptint all in SS1 Gold), it should automatically print from the firs to the last (from Abdullahi Halilu Gulma to Zainab Ibrahim Usman).
Thanks

  • HansVogelaar's avatar
    HansVogelaar
    Oct 13, 2022

    Lukmanayahayya 

    The spin button is grouped with a command button.

    Ungroup them.

    Then right-click the spin button and select Format Control... from the context menu.

    Set the maximum value to 51 instead of 30000, then click OK.

    Finally, group the spin button with the command button again.

  • Lukmanayahayya 

    The number of students is 52.

    The minimum value of the spin button is 0, so you should set the maximum to 51 (0, 1, ..., 51 = 52 values).

     

    Assign the following macro to the PRINT ALL IN SS1 GOLD button:

    Sub Button116_Click()
        Dim ws As Worksheet
        Dim i As Long
        Application.ScreenUpdating = False
        Set ws = Worksheets("SS1 GOLD")
        For i = 0 To 51
            Range("I232").Value = ws.Range("B" & 5 + i).Value
            Application.StatusBar = "Printing report card for " & Range("I232").Value
            Call Macro9
        Next i
        Application.StatusBar = False
        Application.ScreenUpdating = True
    End Sub
    • Lukmanayahayya's avatar
      Lukmanayahayya
      Copper Contributor
      I actually don't understand the first part. Please elaborate on what addition I should include in the macro.

      The second one works perfectly.
      Very very grateful 😀😀
      • HansVogelaar's avatar
        HansVogelaar
        MVP

        Lukmanayahayya 

        The spin button is grouped with a command button.

        Ungroup them.

        Then right-click the spin button and select Format Control... from the context menu.

        Set the maximum value to 51 instead of 30000, then click OK.

        Finally, group the spin button with the command button again.

Resources