How to macro to relative position
Hmm... that's the opposite of your recorded macro, but the change is
simple:
With ActiveCell
If .Parent.Name = Sheet1.Name Then
Sheet2.Range("A1").Value = .Parent.Cells(.Row, 1).Value
Sheet2.Range("C1").Value = .Parent.Cells(.Row, 2).Value
End If
End With
This assumes that by "click the button on row2" you mean, "click the
button with a cell on row 2 active". If you actually have different
buttons, then the answer will depend on what kind of button (i.e., Forms
toolbar or Controls Toolbox).
In article ,
jk9533 wrote:
Not quite.
I need the macro to copy and paste A(X) from Sheet1 to $A$1 of Sheet2 based
on the row position of A(X).
So if I click the button on row 1 on sheet 1 then it will pasts the value of
A1 sheet1 on Sheet2 $A$1. If I click the button on row2 on sheet 1 then it
will paste the value of A2 sheet1 on Sheet2 $A$1
Any suggestions
|