Please I need help to make this macro smarter-Offset problem
Posted by Julia P. on July 19, 2000 8:39 PM
I have this small macro:
Sub addtest()
Dim myselection As range
Set myselection = Selection
On Error Resume Next
Dim column As range
For Each myc In myselection
myc.Offset(0, -2).Value = myc.Value
Next
End Sub
My selection is Col L so myc.offset will be J. I need to use in Offset formula not
-2 but reference to column J so if myselection is other column than L say AB automaticaly will refere always to Offset Col J.
I tried:
Sub addtest()
Dim myselection As range
Set myselection = Selection
On Error Resume Next
Dim column As range
For Each myc In myselection
myc.Offset(0, column(J)).Value = myc.Value
Next
End Sub
but doesn't work. Thanks