MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Copying rows and also running macro on open

Posted by Brian on August 03, 2000 3:05 PM

I have two questions. The first is I am very new to programming in VB and need to run a macro when a file opens. How do I do this. I have the macro read and now how to create a macro to run that macro but where do I put it so that it runs on open. Second I am using an access form to enter in data to excel and when new data is entered I would like the formulas in the other cells in the row to be copied down. IS there somethign I can do to do this? Thanks

Posted by Celia on August 03, 0100 6:37 PM

Go to the VB editor and select the ThisWorkbook object in the Project window.
In the code window, select "workbook" from the right hand drop down box and the following will appear :-

Private Sub Workbook_Open()
End Sub

Call your macro from this procedure.
For an explanation of Event Procedures, have a look at :-

For copying formulas from one row to another, see if the reply to Inserting rows w/formulas - Eric Sustaita 10:37:29 8/03/100 (2) provides what you need.
(This could also be done with an event procedure)