VBA how to include the Last Row as part of the range?

41 views Asked by At

Sorry am still new in VBA and find it confusing. I need to include the last row as part of my range but somehow finds error in it. (see: "Error in this line")

Sub Clear()

Dim r1 as Range
Dim r2 as Range
Dim LastRow as Range

Set r1 = ActiveSheet.UsedRange

LastRow = r1.Rows(r1.Rows.Count).Row
r2 = Range("3:" & LastRow) 'Error in this line

r2.ClearContents

EndSub

I want to include the last row in my range being Range("3:" & Last Row) so I can delete the contents from row 3 all the way down.

Thank you so much!

0

There are 0 answers