I am trying to swap two rows with vba.
I have this code:
Sub copyrow()
Dim temp1 As Range, temp2 As Range, x As Variant
Set temp1 = Range("F4:U4")
Set temp2 = Range("F6:U6")
x = temp1
temp1 = temp2
temp2 = x
End Sub
temp2 gets filled with temp1 which is correct, but somehow temp1 ends up empty? Not sure where I've gone wrong
CodePudding user response:
Specify the .Value
:
x = temp1.Value
temp1.Value = temp2.Value
temp2.Value = x