LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Userform TextBox

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


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform textbox help [email protected] Excel Programming 1 September 17th 06 08:27 AM
TEXTBOX in USERFORM RUUD VAN DEURSEN Excel Programming 5 March 1st 05 03:36 PM
userform textbox Phil Excel Worksheet Functions 5 January 16th 05 06:59 PM
Textbox in userform shaharul[_6_] Excel Programming 3 April 15th 04 12:54 PM
UserForm TextBox to ActiveSheet TextBox over 256 characters Dan E[_2_] Excel Programming 1 July 28th 03 07:36 PM


All times are GMT +1. The time now is 08:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"