Thread: User form
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
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