I have created a macro which copies data from one worksheet to another. I want a generalized macro which copies data from the same row number as that of button, instead of B2
as mentioned below in the code.
Currently this code is working fine; the button text is updated and MacroA
has been assigned to it. I read about topleftcell
, but am unable to implement it.
Sub MacroA()
'
' MacroA Macro
'
Range("I2:J2").Select
Selection.Copy
Range("B2").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
Range("D2").Select
Cells.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveWorkbook.Save
ActiveWindow.Close
End Sub
Untested, but might help you along...