Hopefully the thread title isn't misleading for what I'm trying to do.
I have code that defines a range based on a value from another sheet; then duplicates that range, plus the cells to the left of that range, onto another sheet. So far, so good.
The problem is that now I need to look for the first cell to the left of the range with a value rather than just the cell to the left.
I know I need some kind of For Each Cell in Range statement, but I'm not sure how to fit it into what I have.
Sheets("Data2").Select
Cells(1, 1).Offset(1, Sheets("Results").Cells(2, 1)).Select
'Trouble below
Range(Sheets("Results").Cells(2, 6), Sheets("Results").Cells(20, 5)) = Range(ActiveCell.Offset(0, -1), ActiveCell.Offset(20, 0)).Value
'I'd like to look in each row in the ActiveCell range and find
'the next cell to the left with a value, then duplicate that to the range on "Results"
Range(Sheets("Results").Cells(2, 3), Sheets("Results").Cells(20, 3)) = Range(Cells(2, 1), Cells(20, 1)).Value
I have code that defines a range based on a value from another sheet; then duplicates that range, plus the cells to the left of that range, onto another sheet. So far, so good.
The problem is that now I need to look for the first cell to the left of the range with a value rather than just the cell to the left.
I know I need some kind of For Each Cell in Range statement, but I'm not sure how to fit it into what I have.
Sheets("Data2").Select
Cells(1, 1).Offset(1, Sheets("Results").Cells(2, 1)).Select
'Trouble below
Range(Sheets("Results").Cells(2, 6), Sheets("Results").Cells(20, 5)) = Range(ActiveCell.Offset(0, -1), ActiveCell.Offset(20, 0)).Value
'I'd like to look in each row in the ActiveCell range and find
'the next cell to the left with a value, then duplicate that to the range on "Results"
Range(Sheets("Results").Cells(2, 3), Sheets("Results").Cells(20, 3)) = Range(Cells(2, 1), Cells(20, 1)).Value