Dimitris254
Board Regular
- Joined
- Apr 25, 2016
- Messages
- 139
I'm having hard time getting this to work:
the point is that i want a flexible code, where i find the columns and then create the range, rather than having " Set results_range = .Range("K2:K30") " (which works fine btw)
the error i get is:
Code:
Dim lastRow As Long
Dim results_range As Range
Dim column_results As String
Dim wsDATA As Worksheet
Set wsDATA = ThisWorkbook.Worksheets("DATA")
With wsDATA
Set results_range = .Range(column_results & "2:" & column_results & lastRow)
End With
the point is that i want a flexible code, where i find the columns and then create the range, rather than having " Set results_range = .Range("K2:K30") " (which works fine btw)
the error i get is:
Code:
run-time error 1004:
Method 'Range' of object '_Worksheet' failed