G
Guest
Hi
In order to select an area limited by the number of rows in column A that
contain data in them I was provided with the following code:
Sub Select_area()
Dim LastRowUsed As Integer
Dim rngToCopy As Range
LastRowUsed = Range("A" & Rows.Count).End(xlUp).Row
Set rngToCopy = "A1:U" & LastRowUsed
End Sub
However, when I run this I get a compelation error: type mismatch and the
debugger highlights the & in the Set rngToCopy instruction which I read as
concatinating the number returned with the U to create a range.
Can anyone explain why this has failed and more importantly how to fix it?
As always thanks for any help
In order to select an area limited by the number of rows in column A that
contain data in them I was provided with the following code:
Sub Select_area()
Dim LastRowUsed As Integer
Dim rngToCopy As Range
LastRowUsed = Range("A" & Rows.Count).End(xlUp).Row
Set rngToCopy = "A1:U" & LastRowUsed
End Sub
However, when I run this I get a compelation error: type mismatch and the
debugger highlights the & in the Set rngToCopy instruction which I read as
concatinating the number returned with the U to create a range.
Can anyone explain why this has failed and more importantly how to fix it?
As always thanks for any help