Hi there,
I have this code to swap columns.
It works well until I change myrange to something that starts not from the first row. Why is it happening this way? How to fix it?
Why if I change Evaluate part to myrange.Row it stops working correctly?
P.S. I am aware of other ways to swap columns, but this one for me would be the easiest.
I have this code to swap columns.
Code:
Sub test()
Dim myrange As Range
Set myrange = [A1:C5]
myrange.Offset(, 10) = Application.Index(myrange, Evaluate("Row(" & myrange.Address & ")"), Array(3, 1, 2))
End Sub
It works well until I change myrange to something that starts not from the first row. Why is it happening this way? How to fix it?
Why if I change Evaluate part to myrange.Row it stops working correctly?
P.S. I am aware of other ways to swap columns, but this one for me would be the easiest.