View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Ben McClave Ben McClave is offline
external usenet poster
 
Posts: 173
Default Macro to copy row based on value into new sheet of same name

Frank,

I think that Nathan's routine looks promising for nearly all of your needs. You are probably getting the "Invalid Outside Procedure" message because the code you're using is not within a procedure (a Sub or a Function). A quick fix should be to add a sub name, followed by Nathan's code and then "End Sub". For example:

Sub GetData()

'(Nathan's code from earlier post)

End Sub

When I took Nathan's original code without a Sub name, I received the same error on the same line. But adding "Sub GetData()" and ending with "End Sub" caused no errors for me.

As for the question about running multiple macros upon opening, you could use the "Workbook_Open" event to trigger the macros in the order you specify.. To do so, paste something along these lines into your "ThisWorkbook" module for the workbook in question:

Private Sub Workbook_Open()

Call MyMacro1
Call MyMacro2

End Sub

where "MyMacro1" and "MyMacro2" are the macros you wish to execute upon opening.

Hope this helps.

Ben