Moving to the next cell that is not Hidden, VBA

Andry143

New Member
Joined
Oct 15, 2004
Messages
26
I have a large amount of data that I am doing an advanced filter on using VBA. When this data is sorted in place, several of the lines are Hidden according to the sorting criteria. I would like some code that would allow me to Step/Cursor to the next row that is not hidden. I tried the Offset function and it takes you to the next row regardless of whether it is hidden or not.

Example:

Row 3
Row 8
Row 11

I want the code to Activate Row 3 and then move to Row 8 without Activating Rows 4,5,6,7.

Thanks for the help.
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Hello Andry143,
Without seeing your code it's a bit hard to be very specific but here's a quick little example
that may point you in the right direction.
Code:
Sub NextVisibleCell()
Dim Rng As Range, c As Range
Set Rng = Range("A1:A" & Cells(Rows.Count, "A").End(xlUp).Row)

Columns("A:A").AutoFilter Field:=1, Criteria1:="xyz"
For Each c In Rng.SpecialCells(xlCellTypeVisible)
  MsgBox "The ActiveCell now is " & c.Address(0, 0)
Next
  
End Sub
If this doesn't help can you describe your situation in more detail?
 
Upvote 0

Forum statistics

Threads
1,215,056
Messages
6,122,907
Members
449,096
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top