I am currently trying to figure out how to loop for variable in column A and I want to select range from this cell to the last row with the 2 other column B and C (last row have the same variable).
I have tried
Sub TretourTdepart
Dim LastRow As Long
Dim sh As Worksheet
Dim X As Long
Set sh = Sheets("data_(6)") 'Define sheet to copy from
LastRow = sh.Cells(Rows.Count, 1).End(xlUp).Row 'Find last row to copy from
For X = 2 To LastRow
If sh.Cells(X, 1) = "variable" Then
Set Rng = Range(sh.Cells(LastRow, 1), sh.Cells(X, 1))
Rng.Select
End If
Next
End Sub
but the above script doesn't select the range of cells as I wanted.