View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
LaDdIe LaDdIe is offline
external usenet poster
 
Posts: 131
Default Userform TextBox

Thanks to Both Joel & Bob,

Bob ,

If CDbl(TextName.Text) ActiveCell.Offset(-1, 0) Then

What does CDbl actually do?

"Bob Phillips" wrote:

Try

If CDbl(TextName.Text) ActiveCell.Offset(-1, 0) Then


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"LaDdIe" wrote in message
...
Hiya,

This is my code;

Private Sub OKButton_Click()

' Make sure a name is entered
If TextName.Text = "" Then
MsgBox "You must enter a valid numeric value."
TextName.SetFocus
Exit Sub

End If

If TextName.Text ActiveCell.Offset(-1, 0) Then
MsgBox "Value cannot be greater than hours in the day!"
TextName.Text = ""
TextName.SetFocus
Exit Sub

End If

' Transfer the name
ActiveCell = TextName.Text

'

' Clear the controls for the next entry
TextName.Text = ""
TextName.SetFocus
End Sub

My problem is the second test that checks the value entered, if it is
greater than the offset cell then msg box appears and the value is
rejected,
If offest cell value is say 7.5, and I enter 8.0 then value is rejected
as
it should, but if I enter 10 then the value is accepted, but it should be
rejected is value is still greater than offset cell, But I can't figure
out
why.

Where am I going wrong?

Any help is very much appricated.

Regards

Laddie