Using Offset on Visible cells only

KNKN9

Board Regular
Joined
Mar 27, 2017
Messages
92
Hi,

I have the code

Code:
ActiveSheet.Range("A10").Offset(1, 0).Select

But this does not work for me as my data is filtered. I do not want to unfiltered the data. But how can I use offset on functioning with on the cells that are visible ?
 
I've a User Form that allows the user to filter a list and view a single record in that list. Using arrows on the User Form, they can go to the next visible row in the filtered list and view specific information from that row within the form. Both the code examples above work great for going to the next visible row, but neither work for going back up! I tried changeing Offest(1) to Offset(-1) but it didnt work.

This is the code I've currently. Arrow 1 should move to the previous visible row and retrieve the row number, ProcRow (ProcRow has already been defined during the users initial search and item selection)
VBA Code:
  If Arrow = 1 Or Arrow = 2 Then
        If Arrow = 1 Then
            Set cel = Sheet2.Range("C" & ProcRow)
            ProcRow = Range(cel.Offset(-1), cel.Parent.Cells(Rows.Count, cel.Column)).SpecialCells(xlCellTypeVisible).Cells(1, 1).Row [B](not working)[/B]
        Else
            Set cel = Sheet2.Range("C" & ProcRow)
            ProcRow = Range(cel.Offset(1), cel.Parent.Cells(Rows.Count, cel.Column)).SpecialCells(xlCellTypeVisible).Cells(1, 1).Row
        End If
End If
 
Upvote 0

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
As this is a different question from the op, please start a new thread. Thanks.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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