View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Matt[_39_] Matt[_39_] is offline
external usenet poster
 
Posts: 27
Default Count Visible Range?

i actually have a header row and a subtotals row that aren't being
hidden but, it makes no sense why i keep getting 10560 as the value
for:
Worksheets("Sheet 1").UsedRange.Rows.SpecialCells(xlVisible).Coun t
I have a watch and stepped through the entire macro, when it hides the
last row (before leaving only the header and totals) the value jumps

might i ask why you used columns in your code rather than rows? the
data is all in rows, but if there is something i'm missing and should
be using columns instead, that could be my problem

thanks

Tom Ogilvy wrote:
If Worksheets("Sheet 1").UsedRange.Columns(1).SpecialCells(xlVisible).C ount =
1 Then
' no rows are visible
'More code here
End If


At least the header row should be visible.

If your headers are in the first row and you have no entirely blank rows in
your list

if
Activesheet.Range("A1").CurrentRegion.Columns(1).S pecialCells(xlVisible).count = 1 then
' no rows are visible


--
Regards,
Tom Ogilvy




"Matt" wrote:

I know there are lots of ways to do this procedure, but I was hoping
there might be something already defined.

I have a macro that filters out multiple rows based on certain
criteria. What I'd like to do is use a conditional statement to
determine if there are no remaining visible rows in the used range.

If Worksheets("Sheet 1").UsedRange.Rows.SpecialCells(xlVisible).Coun t =
0 Then
'More code here
End If

Worksheets("Sheet 1").UsedRange.Rows.SpecialCells(xlVisible).Coun t
evaluates, but not to the corrent value (when no rows in the used range
were visible it evalutated to 10560)

Seems to me like this should work, but its not.

Any help would be wonderful