Avatar of Marc Chevalier
Marc Chevalier
Flag for United States of America

asked on 

Excel 365 spreadsheet not initializing field values with Private Sub AutoOpen command?

I have a simple spreadsheet with 5 fields on it that is to be used as an entry form for printing.  The idea is the user just opens the spreadsheet, fills in the fields, and clicks on the PRINT button at the bottom of the spreadsheet to print the simple form.  I am using excel 365 and I put some simple VBA code on the spreadsheet to initialize the 5 fields as the spreadsheet opens, but it does not initialize the fields?  This is the code I am using:

Private Sub AutoOpen_()
Range("C3").Value = " "
Range("B5").Value = " "
Range("F5").Value = " "
Range("B9").Value = " "
Range("B10").Value = " "
Range("B11").Value = " "
MsgBox ("AutoOpen")
End Sub

I have also placed the spreadsheet in a trusted directory and saved it as an xlsm type spreadsheet.  I don't understand why it is not working?
Microsoft ExcelMicrosoft 365Visual Basic ClassicVBA

Avatar of undefined
Last Comment
[ fanpages ]

8/22/2022 - Mon