Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Compare Strings
Is there an easy way (using VBA) to compare the values of 3 text
boxes? I want to make sure that the values of all 3 text boxes are NOT the same. I tried StrComp, but that only compares 2 string. I assumed there would be an easy way without having nested if's.... Thanks, DK |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Compare Strings
Hi,
You can try this: Me.TextBox1 = Me.TextBox2 And Me.TextBox1 = Me.TextBox3 If this helps, please check the Yes button -- Thanks, Shane Devenshire "dksaluki" wrote: Is there an easy way (using VBA) to compare the values of 3 text boxes? I want to make sure that the values of all 3 text boxes are NOT the same. I tried StrComp, but that only compares 2 string. I assumed there would be an easy way without having nested if's.... Thanks, DK |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Compare Strings
Hmm,
Shouldn't ist be more like Me.TextBox1 = Me.TextBox2 Or Me.TextBox1 = Me.TextBox3 Or Me.TextBox2 = Me.TextBox3 ? Regards, Bernd |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Compare Strings
I'll try that! thank you all very much
DK |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
Compare Strings
On Sat, 18 Oct 2008 06:35:31 -0700 (PDT), dksaluki wrote:
Is there an easy way (using VBA) to compare the values of 3 text boxes? I want to make sure that the values of all 3 text boxes are NOT the same. I tried StrComp, but that only compares 2 string. I assumed there would be an easy way without having nested if's.... Thanks, DK Perhaps this example will help: ==================== Option Explicit 'set comparison type to either Text or Binary Option Compare Text Sub Comp3() Const s1 As String = "def" Const s2 As String = "abc" Const s3 As String = "ABC" Select Case _ (s1 = s2) + (s1 = s3) + (s2 = s3) Case Is = 0 Debug.Print "All Different" Case Is = -1 Debug.Print "One match" Case Is = -3 Debug.Print "all the same" End Select ========================== --ron |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Compare two strings | Excel Worksheet Functions | |||
How to find number of pairs of strings from list of strings? | Excel Worksheet Functions | |||
Compare the strings | Excel Discussion (Misc queries) | |||
How can I count strings within strings | Excel Worksheet Functions | |||
Compare cells/columns and highlight matching text strings | Excel Worksheet Functions |