Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Navigating Visible cells only

Status
Not open for further replies.

deedisdone

IS-IT--Management
Aug 9, 2001
1
US
I am trying to move down a certain number of rows x amount of times, regardless if there is visible or hidden rows. Here's a copy of some of the code.

vCMoveMe = 1
vMoveMe = Range(vSdOr & newname & "count").Value
Do While vCMoveMe < vMoveMe
If Selection.EntireRow.Hidden = False Then
ActiveCell.Offset(1, 0).Activate
vCMoveMe = vCMoveMe + 1
End If
If Selection.EntireRow.Hidden = True Then
ActiveCell.Offset(1, 0).Activate
End If
Loop
Do While Selection.EntireRow.Hidden = True
ActiveCell.Offset(1, 0).Activate
Loop

It needs to go through this and reach a final point in a column with other data in it. I have tried ActiveCell.Offset(x, 0).activate, where x is the number of rows down I want to move, but I only want to move x amount of times if the rows are visible. Is there an easier way to do this? The code above is slowing my procedure down to a crawl. Thanks in advance
 
Not sure if I understand the your code but maybe this might help.

'Change &quot;A:A&quot; to whatever column you are looking at
with ActiveSheet
CountOfVisibleRows = _
WorksheetFunction.CountA(.Range(&quot;A:A&quot;).SpecialCells(xlVisible))

end with


That will give you the number of visible rows and tell you how many you need to move down.

HTH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top