Selecting next Visible Cell in Filtered range

Cbluum7

Board Regular
Joined
Dec 11, 2006
Messages
81
I have filtered data that i want to be able to loop thru without actually selecting the next cell in the range. I am just grabbing the values and pasting them on a different spreadsheet. The problem i have is selecting the next cells that are not in sequential order. Here is my code but it does not work. If my visible range jumps from 5 to 20, my strSubGroupNext will always take row 6 instead of row 20. Any suggestions? I have tried offset to no avail and many other possibilities.

Range("D2:D" & LastRow_Master).Select
Selection.SpecialCells(xlCellTypeVisible).Select

f = 1

For Each strSubGroup In Selection.SpecialCells(xlCellTypeVisible)

strSubGroupNext = Selection.SpecialCells(xlCellTypeVisible)(f + 1).Value
strGroup = Selection.SpecialCells(xlCellTypeVisible).Offset(0, -1)(f).Value
strGroupnext = Selection.SpecialCells(xlCellTypeVisible).Offset(1, -1)(f).Value

More code here......

Next
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,224,618
Messages
6,179,919
Members
452,949
Latest member
beartooth91

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