RockandGrohl
Well-known Member
- Joined
- Aug 1, 2018
- Messages
- 790
- Office Version
- 365
- Platform
- Windows
Hello all,
Have this excellent piece of code which selects the data on the first visible row, column B
I want to run a for loop as I would like to select some cells in the first visible row, then the second, then the third etc.
So in my mind, it would be like this:
This would give me the first row, column A of data which is the new "tref"
And I was hoping by doing range.offset(x) which would then be 2, then 3, then 4 it would work.
Unfortunately not however as it seems to be able to get the first filtered row of data, but none after it.
Anyone have a solution on where I can just select the second, third, fourth etc row of data? Cheers!
Have this excellent piece of code which selects the data on the first visible row, column B
VBA Code:
ActiveSheet.AutoFilter.Range.Offset(1).SpecialCells(xlCellTypeVisible).Cells(1, 2).Value
I want to run a for loop as I would like to select some cells in the first visible row, then the second, then the third etc.
So in my mind, it would be like this:
VBA Code:
x = 1
For x = 1 To 10
newtref = ActiveSheet.AutoFilter.Range.Offset(x).SpecialCells(xlCellTypeVisible).Cells(x, 1).Value
' switch to another sheet and dump the data off here
' switch back to the filtered sheet
Next x
This would give me the first row, column A of data which is the new "tref"
And I was hoping by doing range.offset(x) which would then be 2, then 3, then 4 it would work.
Unfortunately not however as it seems to be able to get the first filtered row of data, but none after it.
Anyone have a solution on where I can just select the second, third, fourth etc row of data? Cheers!