View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Macro to run if cell empty

Greg,

Put the following in the ThisWorkbook code module:

Private Sub Workbook_Open()
On Error Resume Next
Dim NameExists As Boolean
If Me.Worksheets("SHeet1").Range("A1").Value = "" Then
NameExists = CBool(Len(ThisWorkbook.Names("RunOnce").Name))
If NameExists = False Then
UserForm1.Show
ThisWorkbook.Names.Add Name:="RunOnce", RefersTo:="Yes"
End If
End If
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"Greg" wrote in message
...
I wanted to run a userform once when this workbook is loaded for
the first
time. I needed the user to place some information information
in this form.
Once this userform is used I did not want it to load up again.

Not sure how to do this exactly though maybe it could look up
the cell where
this information would be placed. If empty run a macro and then
once the
form has been used it will have the information in the cell so
it would not
be run again.

Thanks again any help is appreciated

Greg