Button to unhide one hideden row each time its pressed

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,194
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone,
I need a mmacro that when run does this

Looks at the range D21:D50
Finds Last row with data in it (must be last row with range D21:D50 as there stuff above and below it)
then unhides the next row
so for example when you start D22:D50 will be hidden
you press the button,
If D21 is empty it does nothing but if D21 <> "" then unhide D22
abd so on until it gets to D50
If there are no more rows to unhide messagebox "All rows have been used"

please help if you can

Thanks

Tony
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Not sure if I got your requirements right.

Try:
VBA Code:
Sub me1158757()
    Dim i As Long
    Application.ScreenUpdating = False
    Rows("21:50").Hidden = True
    For i = 21 To 49
        If Cells(i, "D").Value <> "" Then
            Rows(i + 1).Hidden = False
        End If
    Next
    Application.ScreenUpdating = True
    If Cells(50, "D").Value <> "" Then MsgBox "All rows have been used"
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,009
Messages
6,122,674
Members
449,091
Latest member
peppernaut

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top