Hi,
am constructing range query dynamically. see below
I am storing result in rngData1 variable. It is a string. when i display it with msgbox it works fine.
It's not working when i try to set that as my Object .
It work if hardcode it like - Set rngData = ActiveSheet.Range("A1:A500000,B1:B500000")
If Sheets("SearchSheet").Range("M9").Value = True Then
bu = "A2:A500000,"
Else
bu = "H1:I1,"
End If
If Sheets("SearchSheet").Range("M11").Value = True Then
Fa = "B2:B500000"
Else
Fa = "H1:I1"
End If
rngData1 = "ActiveSheet.Range(" & Chr(34) & bu & Fa & Chr(34) & ")"
Set rngData = rngData1 ---- issue here .can't place string in object rngdata
Bookmarks