View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default code gone wrong when trying to make an automated form

USRNM = Range("b5").Select
should be
USRNM = Range("b5").Value ' or .text???

And check it with:

If USRNM = "" Then

DawnTreader wrote:

hello

the problem is that everytime i open my spreadsheet the dialog i created to
open at the begining pops up. that is exactly what i want it to do, but i
only want to do it once. the reason is that once you open it again after
saving you have the popup come up and then you have to enter the information
for specific cells again.

here is my code that is giving me trouble. the popup doesnt show at all.
whether the cell b5 is empty or not.

Private Sub Workbook_Open()
Dim USRNM As String

USRNM = Range("b5").Select

If IsNull(USRNM) Then
TimeCardInfo.Show
End If

End Sub

here is all the other code for the project. just incase there is something
that is causing the problem there. this code is attached to the user form i
have created to popup whenever the book is opened.

Private Sub Ok_Click()

Range("b5").Select
ActiveCell.Value = UserName
Range("e5").Select
ActiveCell.Value = EmployNumber
Range("a11").Select
ActiveCell.Value = Enterdatebox
Range("b8").Select

Hide
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
MsgBox "Please use the OK button after entering required data!"
End If
End Sub

if anyone can offer a sugestion as to how to make it only popup if the cell
b5 is blank that would be great!


--

Dave Peterson