ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   code gone wrong when trying to make an automated form (https://www.excelbanter.com/excel-programming/375974-code-gone-wrong-when-trying-make-automated-form.html)

DawnTreader

code gone wrong when trying to make an automated form
 
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

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

DawnTreader

code gone wrong when trying to make an automated form
 
Hello

k, will try this thanks!

"Dave Peterson" wrote:

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


DawnTreader

code gone wrong when trying to make an automated form
 
Hello

you rock!

that worked great.

i used ".value" and it does exactly what i wanted. thanks so much. :)

"Dave Peterson" wrote:

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



All times are GMT +1. The time now is 05:24 PM.

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