I am trying to write a macro that calls another macro, but am running into difficulties. My company has a macro that imports data. The macro has a button that requires that you type or paste in a certain code that uniquely IDs a data series, then click import data, then wa la the vba code does all the hard work of pasting in the data for you.
I am trying to write a second macro that loops through the universe of unique codes and automatically runs this import one time for each code and saves a separate file for each code so I don't even have to type in all the codes myself and wait for vba to run before my data appears. The problem is when I try and record the 2nd looping macro, I (1) run the old macro and (2) paste in the code, but VBA doesn't seem to recognize the macro button as a place (like a cell) so it is not capturing that I am pasting in the code into the macro button interface. Help! Is there a way around this? Thank you very much.
Sub Macro1()
'
' Macro1 Macro
'
'
Sheets("list of unique codes").Select [here is where I'm selecting the unique code]
Range("E2").Select
ActiveCell.FormulaR1C1 = "code1" [the unique code is code1]
Sheets("Screen").Select
Application.Run "'Import Data Template.xlsm'!Sheet01.ImportButton_Click" [this is the old macro, but it's not recognizing that I'm actually pasting in the text string 'code1' into the macro button interface]
End Sub [ultimately I plan to make this subroutine a loop]
Bookmarks