I am using a command button to unhide extra rows. I have it set so that each time you click the button it unhides the next row. I have 5 of these in the worksheet.
Is it possible change my VBA so that instead of telling it to start at row 17 I can tell it to start at the first row in the table named "Time Labor"?
Private Sub CommandButton1_Click()
Dim r As Long
r = 17
Do Until Rows(r).Hidden = True Or r > 32
r = r 1
Loop
If r <= 32 Then Rows(r).Hidden = False
End Sub
CodePudding user response:
If you have a listobject/table named "Time Labor" then its first row could be found like this:
r = ListObjects("Time Labor").ListRows(1).Range.Row