Hi All, i am trying to write a VBA code to create a button in my excel workbook(workbook1) for below function
For each data in column A, copy the data and paste it to another macro workbook(workbook2) at cell "C2", then click the button in workbook2 to run the macro, after running the macro in wb2, copy the result data from sheet2.cell C30 back to my workbook1 at column B
I have created some code like below but it seems not working.
See if anyone can help on this, newbie here
For each data in column A, copy the data and paste it to another macro workbook(workbook2) at cell "C2", then click the button in workbook2 to run the macro, after running the macro in wb2, copy the result data from sheet2.cell C30 back to my workbook1 at column B
I have created some code like below but it seems not working.
VBA Code:
Sub Auto()
f_path = "C:\temp\workbook1.xlsm"
set wb1 as workbooks.Open(f_path)
f_path2 = "C:\temp\workbook2.xlsm"
set wb2 as workbooks.Open(f_path2)
Dim 1 as Long
For i = 2 to 1000
Workbooks("wb2").Worksheets("sheet1").Range("A" & i).Copy _
Workbooks("wb1").Worksheets("Sheet1").Range("C2")
Application.Run.workbooks("wb1").Worksheets("Sheet1").Shapes("macro1").Onaction
Workbooks("wb1").Worksheets("Sheet2").Range("C30").Copy _
Workbooks("wb2").Worksheets("sheet1").Range("B" & i)
Next i
End Sub
See if anyone can help on this, newbie here