Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default userform help

can someone tell me why i get the message box no matter what i type in? if i
only use 1 condition, it works, as soon as i add the second, nothing works.

If UCase(Trim(Me.LSite.Value)) < "M" Or _
UCase(Trim(Me.LSite.Value)) < "N" Then
Me.LSite.SetFocus
MsgBox "Please Check Site"
Exit Sub
End If

--


Gary



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default userform help

Do a little truth table:

Entry <"M" <"N" <"M" Or <"N"

M FALSE TRUE TRUE
N TRUE FALSE TRUE
A TRUE TRUE TRUE

I suspect your want "And" instead of "Or"

Entry <"M" <"N" <"M" And <"N"

M FALSE TRUE FALSE
N TRUE FALSE FALSE
A TRUE TRUE TRUE



In article ,
"Gary Keramidas" <GKeramidasATmsn.com wrote:

can someone tell me why i get the message box no matter what i type in? if i
only use 1 condition, it works, as soon as i add the second, nothing works.

If UCase(Trim(Me.LSite.Value)) < "M" Or _
UCase(Trim(Me.LSite.Value)) < "N" Then
Me.LSite.SetFocus
MsgBox "Please Check Site"
Exit Sub
End If

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default userform help

Because your test drives it that way.

If it is equal to M, it will pass the < "N" test
If it is equal to N, it will pass the < "M" test
If neither N nor M, it will pass the < "M" test

Are you sure you don't mean AND instead of OR


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
can someone tell me why i get the message box no matter what i type in? if

i
only use 1 condition, it works, as soon as i add the second, nothing

works.

If UCase(Trim(Me.LSite.Value)) < "M" Or _
UCase(Trim(Me.LSite.Value)) < "N" Then
Me.LSite.SetFocus
MsgBox "Please Check Site"
Exit Sub
End If

--


Gary





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default userform help

i only want to accept M and N as possible entries, nothing else.

--


Gary


"Bob Phillips" wrote in message
...
Because your test drives it that way.

If it is equal to M, it will pass the < "N" test
If it is equal to N, it will pass the < "M" test
If neither N nor M, it will pass the < "M" test

Are you sure you don't mean AND instead of OR


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
can someone tell me why i get the message box no matter what i type in?
if

i
only use 1 condition, it works, as soon as i add the second, nothing

works.

If UCase(Trim(Me.LSite.Value)) < "M" Or _
UCase(Trim(Me.LSite.Value)) < "N" Then
Me.LSite.SetFocus
MsgBox "Please Check Site"
Exit Sub
End If

--


Gary







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default userform help

See my reply.

In article ,
"Gary Keramidas" <GKeramidasATmsn.com wrote:

i only want to accept M and N as possible entries, nothing else.

--



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default userform help

and seems to work, thanks

--


Gary


"JE McGimpsey" wrote in message
...
See my reply.

In article ,
"Gary Keramidas" <GKeramidasATmsn.com wrote:

i only want to accept M and N as possible entries, nothing else.

--



Reply
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 from a Userform Problem Adrian Excel Programming 1 October 12th 05 04:57 PM
Looping procedure calls userform; how to exit loop (via userform button)? KR Excel Programming 6 July 27th 05 12:57 PM
Activating userform and filling it with data form row where userform is activate Marthijn Beusekom via OfficeKB.com[_2_] Excel Programming 3 May 6th 05 05:44 PM
Access from add_in userform to main template userform.... Ajit Excel Programming 1 November 18th 04 05:15 PM
Linking userform to userform in Excel 2003 missmelis01 Excel Programming 2 August 27th 04 08:07 PM


All times are GMT +1. The time now is 08:45 PM.

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

About Us

"It's about Microsoft Excel"