ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Quick and Easy! (https://www.excelbanter.com/excel-programming/329275-quick-easy.html)

DBAL[_6_]

Quick and Easy!
 
What is the proper 'Sub' - 'End Sub' Syntax to make some VBA run when the
Excel file is first opened? Workbook_Open() something or other????

DBAL
Thanks!


Jim Thomlinson[_3_]

Quick and Easy!
 
Private Sub Workbook_Open()

End Sub

Pasted in the ThisWorkbook Object in the VBE
Right Click on Excel Icon in the upper left of the Excel Window and choose
View Code. Paste this code.

HTH

"DBAL" wrote:

What is the proper 'Sub' - 'End Sub' Syntax to make some VBA run when the
Excel file is first opened? Workbook_Open() something or other????

DBAL
Thanks!


DBAL[_6_]

Quick and Easy!
 
Ahh man, so that's the problem, I had the right code, but I guess it was in
the wrong place! So the workbook code is kept in a different spot then...
Thanks!

"Jim Thomlinson" wrote:

Private Sub Workbook_Open()

End Sub

Pasted in the ThisWorkbook Object in the VBE
Right Click on Excel Icon in the upper left of the Excel Window and choose
View Code. Paste this code.

HTH

"DBAL" wrote:

What is the proper 'Sub' - 'End Sub' Syntax to make some VBA run when the
Excel file is first opened? Workbook_Open() something or other????

DBAL
Thanks!


Patrick Molloy[_2_]

Quick and Easy!
 
you can also use

Sub Auto_Open()
' your code
End SUb

in a standard module

"DBAL" wrote:

What is the proper 'Sub' - 'End Sub' Syntax to make some VBA run when the
Excel file is first opened? Workbook_Open() something or other????

DBAL
Thanks!



All times are GMT +1. The time now is 10:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com