am not re-numbering/re-sequencing it. the full sheet (hide and unhide) will
not be numbered. it will only be numbered after hiding those unwanted rows.
but when i try to number/sequence it on the unhidden rows.....the numbers
will include those hidden too.
Please note I may need to retrieve some of the hidden row for later use
hence am not deleting but hiding it.
Try this macro. It inserts a new column A, then in that column numbers only
the visible rows.
Sub NumberVisibleRows()
Dim x As Long, Rng As Range
x = 0
'Insert a new column A on the active sheet.
Range("A1").Select
Selection.EntireColumn.Insert
'Select the new column A.
Columns("A:A").Select
'Walk down column A.
For Each Rng In Selection
'If row is not hidden, increment the
'counter and number the row.
If Rng.EntireRow.Hidden = False Then
x = x + 1
Rng.Value = x
End If
'Move to the next row.
Next Rng
End Sub
Hope this helps,
Hutch
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.