ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Define Startrow (https://www.excelbanter.com/excel-discussion-misc-queries/71531-define-startrow.html)

Frank

Define Startrow
 
Hello,

I have a macro that I use to automatically unhide the first row of a
group of hidden rows:

Sub UnhideFirstRow()
startrow = ActiveSheet.UsedRange.Row
stoprow = startrow + ActiveSheet.UsedRange.Rows.Count - 1
For i = startrow To stoprow
If Rows(i).Hidden Then
Rows(i).Hidden = False
Exit For
End If
Next i
End Sub

How can I define the startrow to use the first visible row instead of
the first row with data? My spreadsheet is set up that I have a set of
unhidden rows with hidden rows at the top and bottom of the page.
(e.g. row 1 has header info that is unhidden and frozen, rows 2-10
hidden but with valid "old" data, rows 11-30 unhidden with current
data, rows 31-50 hidden and will be used for data entry once unhidden)
The macro above unhides row 2 and I would like it to unhide 31.

Thanks,

Frank

PS- I can't use a macro that has a predefined row x because every
worksheet has a different "range" of unhidden cells.



All times are GMT +1. The time now is 08:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com