Prev: Hyperlink opens word template for editting, not as new document
Next: File Name and Full Path Name
From: Mike H on 28 Jan 2010 15:18 Hi, One way Sub CountHighlightedRows() For Each c In Selection.Rows If c.RowHeight > 0 Then viz = viz + 1 End If Next MsgBox viz End Sub -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "Phil H" wrote: > Need to modify this maco to not count hidden rows. For example if seven rows > of ten rows in question are hidden, I need the macro to count only the three > visible on screen. > > Also, if no rows were hidden, and all ten were selected (highlighted), the > macro should count ten. > > In other words, it should count only what is selected/visible on screen. > > Sub CountHighlightedRows() > MsgBox "Rows Selected: " & Selection.Rows.Count > End Sub
From: Phil H on 28 Jan 2010 15:30 Thanks for the help! "Ryan H" wrote: > This will count all the visible rows in your selection. Hope this helps! If > so, let me know, click "YES" below. > > Option Explicit > > Sub CountHighlightedRows() > > Dim rw As Range > Dim VisibleRows As Long > > For Each rw In Selection.Rows > If rw.Hidden = False Then > VisibleRows = VisibleRows + 1 > End If > Next rw > > MsgBox "Rows Selected: " & VisibleRows, vbInformation > > End Sub > -- > Cheers, > Ryan > > > "Phil H" wrote: > > > Need to modify this maco to not count hidden rows. For example if seven rows > > of ten rows in question are hidden, I need the macro to count only the three > > visible on screen. > > > > Also, if no rows were hidden, and all ten were selected (highlighted), the > > macro should count ten. > > > > In other words, it should count only what is selected/visible on screen. > > > > Sub CountHighlightedRows() > > MsgBox "Rows Selected: " & Selection.Rows.Count > > End Sub
From: Phil H on 28 Jan 2010 15:31 Thanks for the help! "Mike H" wrote: > Hi, > > One way > > Sub CountHighlightedRows() > For Each c In Selection.Rows > If c.RowHeight > 0 Then > viz = viz + 1 > End If > Next > MsgBox viz > End Sub > -- > Mike > > When competing hypotheses are otherwise equal, adopt the hypothesis that > introduces the fewest assumptions while still sufficiently answering the > question. > > > "Phil H" wrote: > > > Need to modify this maco to not count hidden rows. For example if seven rows > > of ten rows in question are hidden, I need the macro to count only the three > > visible on screen. > > > > Also, if no rows were hidden, and all ten were selected (highlighted), the > > macro should count ten. > > > > In other words, it should count only what is selected/visible on screen. > > > > Sub CountHighlightedRows() > > MsgBox "Rows Selected: " & Selection.Rows.Count > > End Sub
First
|
Prev
|
Pages: 1 2 Prev: Hyperlink opens word template for editting, not as new document Next: File Name and Full Path Name |