Autostart Macro

G

Guest

I would like a simple text box or message to appear when a spreadsheet is
first opened that will require the user to push OK.

What I actually want is a box to pop up as sson as the spreadsheet is opened
that says "Only enter data in cells that are color coded Tan!" I would like
the message to stay on the screen until the uses clicks an OK button.

How would I accomplish this?

Thanks,

Ken
 
G

Guest

Press Alt+F11 and in the project explorer on the left of the screen, double
click ThisWorkbook to open the workbook module.

Place something similar to the following code in the Workbook's On Open event.

Private Sub Workbook_Open()

MsgBox "Only enter data in the cells w/tan color."

End Sub
 
D

Dave Peterson

This goes in a General module--not behind a worksheet, not behind ThisWorkbook.

Option Explicit
Sub Auto_Open()
Msgbox "Only enter data in cells that are color coded Tan!"
End Sub
 
G

Guest

Hi Dave ,
could you please help me how to enter text in two lines of message box ?
and how to change font properties colour etc...
 
D

Dave Peterson

You can't change the font properties in a plain old msgbox. But you could
design your own userform and do as much customization as you want:

Option Explicit
Sub Auto_Open()
Msgbox "Only enter data in cells" & vblf & "that are color coded Tan!"
'or
Msgbox "Only enter data in cells" & vbnewline & "that are color coded Tan!"
End Sub

In the windows world, vblf (linefeed) is sufficient.

If you have to support both Wintel and Mac's, you may want to use vbnewline.
That constant is smart enough to know what to use on each.
 
N

Narasimha

Thank you Dave .

Dave Peterson said:
You can't change the font properties in a plain old msgbox. But you could
design your own userform and do as much customization as you want:

Option Explicit
Sub Auto_Open()
Msgbox "Only enter data in cells" & vblf & "that are color coded Tan!"
'or
Msgbox "Only enter data in cells" & vbnewline & "that are color coded Tan!"
End Sub

In the windows world, vblf (linefeed) is sufficient.

If you have to support both Wintel and Mac's, you may want to use vbnewline.
That constant is smart enough to know what to use on each.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top