I want to select a range in Excel (A50:B80) and delete all of its content. I will keep two rows and I want the next loop iteration to then start at (A52:B82) and so on. This is what I have so far:
Sub Macro2()
Dim i As Integer
Dim num As Integer
num = 50
Dim num_2 As Integer
num_2 = 80
For i = 1 To 2:
Set Range1 = Range("A" & num)
Set Range2 = Range("B" & num_2)
Range(Range1, Range2).Select
Selection.delete Shift:=x1Up
num = num + 2
num_2 = num + 2
Next i
End Sub
But I keep getting "Run-time error '1004: Delete method of Range class failed.
Any help would be appreciated!