Thread: Row Sequencing
View Single Post
  #2   Report Post  
Gary L Brown
 
Posts: n/a
Default

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?