-
getting the row numbers of visible rows in an filtered selection
Hello all,
I have an Excel 2007 table which has 1500 rows and 60 columns of data. I use autofilter to filter out some information. For example I have filtered row 5, 12, 12 and 18. I select some rows (row 5 and 12)
I need a macro to find out the row numbers of these selected rows.
Thanks in advance.
catgreen
-
[VBA]Sub blah()
For Each rw In Selection.Rows
If Not rw.Hidden Then MsgBox rw.Row
Next rw
End Sub
[/VBA]
p45cal
Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.
-
I'm not sure what you want to do with those row numbers (put them in an array?, add them? ..), but some variation of this should work.
[VBA]With Selection
If .Cells.Count = 1 Then
MsgBox .Address
Else
MsgBox .SpecialCells(xlCellTypeVisible).Address
End If
End With[/VBA]
-
Sorry for my late response, this solution worked problem free thank you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules