All I really want is the sum of all rows, since the number of the last row
reflects skipped rows. For example, last row says 2400, but it's actually
less since there are hidden rows. I want the actually number of rows
showing. Is there a simple way to get this?
"Gary L Brown" wrote:
Try this macro - select the range you want to put the numbers first and put
your starting number in the first cell of the selection.
'/=================================================/
Sub Row_List()
Dim rngCell As Range
Dim strAddress As String
strAddress = Selection.Range("A1").Address
For Each rngCell In Selection
If Hidden_Row(rngCell) = False Then
If strAddress < rngCell.Address Then
rngCell.Formula = "=" & strAddress & " + 1"
strAddress = rngCell.Address
End If
End If
Next rngCell
End Sub
'/=================================================/
Public Function Hidden_Row(rng As Range) As Long
'return 1 if row is hidden, 0 if row is visible
Application.Volatile
On Error Resume Next
Hidden_Row = 0
If rng.EntireRow.Hidden = True Then
Hidden_Row = 1
End If
End Function
'/=================================================/
HTH,
--
Gary Brown
If this post was helpful, please click the ''''Yes'''' button next to
''''Was this Post Helpfull to you?".
"Mark" wrote:
I have done a number of sorts and filters and rows now skip the numbers that
are hidden. Now I am satisfied with the rows showing and I want a straight
numerical sequence of the rows shown, without any numbers skipped. Can I get
this?