Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Apples or pears

Hi could someone show me the correct way of writing this code:

If Me.TextBox1.Text = "Apples" or "pears" Then
Unload Me
UserForm4.Show
End If

thanks
GK


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Apples or pears

Hi

Try this one:

If Ucase(Me.TextBox1.Text) = "APPLES" Or _
Ucase(Me.TextBox1.Text) = "PEARS" Then
Unload Me
UserForm4.Show
End If

The use of Ucase() means, that the user can
enter any combination of upper- and/or lower case
in the text box.

--
Best Regards
Leo Heuser

Followup to newsgroup only please.

"gregork" skrev i en meddelelse
...
Hi could someone show me the correct way of writing this code:

If Me.TextBox1.Text = "Apples" or "pears" Then
Unload Me
UserForm4.Show
End If

thanks
GK




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Apples or pears

Thanks for the reply. Can't get it to work though. Not sure why?

cheers
GK

"Leo Heuser" wrote in message
...
Hi

Try this one:

If Ucase(Me.TextBox1.Text) = "APPLES" Or _
Ucase(Me.TextBox1.Text) = "PEARS" Then
Unload Me
UserForm4.Show
End If

The use of Ucase() means, that the user can
enter any combination of upper- and/or lower case
in the text box.

--
Best Regards
Leo Heuser

Followup to newsgroup only please.

"gregork" skrev i en meddelelse
...
Hi could someone show me the correct way of writing this code:

If Me.TextBox1.Text = "Apples" or "pears" Then
Unload Me
UserForm4.Show
End If

thanks
GK






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Apples or pears

If instr(1,Me.Textbox1.Text,"apples",vbTextcompare) 0 or _
instr(1,Me.Textbox1.Text,"pears",vbTextcompare) 0 then
Unload Me
Userform4.Show
End if

--
Regards,
Tom Ogilvy


"Leo Heuser" wrote in message
...
Hi

Try this one:

If Ucase(Me.TextBox1.Text) = "APPLES" Or _
Ucase(Me.TextBox1.Text) = "PEARS" Then
Unload Me
UserForm4.Show
End If

The use of Ucase() means, that the user can
enter any combination of upper- and/or lower case
in the text box.

--
Best Regards
Leo Heuser

Followup to newsgroup only please.

"gregork" skrev i en meddelelse
...
Hi could someone show me the correct way of writing this code:

If Me.TextBox1.Text = "Apples" or "pears" Then
Unload Me
UserForm4.Show
End If

thanks
GK






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Apples or pears

Works perfectly thanks Tom

Regards
GK

"Tom Ogilvy" wrote in message
...
If instr(1,Me.Textbox1.Text,"apples",vbTextcompare) 0 or _
instr(1,Me.Textbox1.Text,"pears",vbTextcompare) 0 then
Unload Me
Userform4.Show
End if

--
Regards,
Tom Ogilvy


"Leo Heuser" wrote in message
...
Hi

Try this one:

If Ucase(Me.TextBox1.Text) = "APPLES" Or _
Ucase(Me.TextBox1.Text) = "PEARS" Then
Unload Me
UserForm4.Show
End If

The use of Ucase() means, that the user can
enter any combination of upper- and/or lower case
in the text box.

--
Best Regards
Leo Heuser

Followup to newsgroup only please.

"gregork" skrev i en meddelelse
...
Hi could someone show me the correct way of writing this code:

If Me.TextBox1.Text = "Apples" or "pears" Then
Unload Me
UserForm4.Show
End If

thanks
GK








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
can I nest COUNTIF functions(C5:C8,"apples") AND (D5:D8,"green") guycummins Excel Worksheet Functions 4 June 10th 08 09:23 PM
Who buys the apples Benj Excel Discussion (Misc queries) 2 July 13th 05 11:16 AM


All times are GMT +1. The time now is 09:01 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"