I have a userform which begins with a "Find File" button.
Once the user has found the excel sheet he wishes to use (which has a macro on it that does a specific thing) the "Find File" macro opens the worksheet. Once this is done, how can I set it to run the macro on that newly opened worksheet?
I dont know if i can set a Dim or something to do this or also if i need to set the specific macro name but assume the macro name is macro1 if that is the case![]()
Private Sub CommandButton1_Click() ChDrive "D:\" ChDir "D:\Documents" FileToOpen = Application.GetOpenFilename _ (Title:="Please choose a file to import", _ FileFilter:="Excel Files *.xls (*.xls),") If FileToOpen = False Then MsgBox "No file specified. You must select a file for the macro to run", vbExclamation, "Error" Exit Sub Else Workbooks.Open Filename:=FileToOpen End If End Sub
Thanks,
Penfold
Bookmarks