#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default User form


I am new to dealing with userforms.

I have created a user form and after the user clicks on the OK button
would like to test to see if the user entered 3 different items. Two o
those items are just choosing an item from a list box. I have similia
test for all three. I can get the test to work for two but not th
third. Does anyone know someone that might could help me with this?

Thank

--
houndhe

red headed strange
-----------------------------------------------------------------------
houndhen's Profile: http://www.excelforum.com/member.php...nfo&userid=282
View this thread: http://www.excelforum.com/showthread.php?threadid=47155

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default User form

You choose an item from two different listboxes and where does the third item
come from? Another listbox?

Option Explicit
Sub testme()

Dim NumMatches As Long
Dim str1 As String
Dim str2 As String
Dim str3 As String

'put something in those strings
str1 = "asdf1"
str2 = "asdf2"
str3 = "asdf1"

NumMatches = 0
If (str1 = str2) _
And (str2 = str3) Then
NumMatches = 3
Else
If str1 = str2 _
Or str2 = str3 _
Or str1 = str3 Then
NumMatches = 2
End If
End If

MsgBox NumMatches

End Sub




houndhen wrote:

I am new to dealing with userforms.

I have created a user form and after the user clicks on the OK button I
would like to test to see if the user entered 3 different items. Two of
those items are just choosing an item from a list box. I have similiar
test for all three. I can get the test to work for two but not the
third. Does anyone know someone that might could help me with this?

Thanks

--
houndhen

red headed stranger
------------------------------------------------------------------------
houndhen's Profile: http://www.excelforum.com/member.php...fo&userid=2828
View this thread: http://www.excelforum.com/showthread...hreadid=471552


--

Dave Peterson
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
How do I fill a cell in a user form from a selection on same form? Terry Tipsy Excel Discussion (Misc queries) 4 June 11th 07 02:59 PM
User Form Discovery Excel Programming 5 August 3rd 05 10:36 PM
How to: User Form to assign a user defined range to a macro variab TrevTrav Excel Programming 1 March 22nd 05 07:57 PM
I am looking to see if anybody has an equivalant user form to Outlooks CONTACT form BruceJ[_2_] Excel Programming 2 October 15th 03 05:28 PM


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