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 |
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 |
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 |
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 |
Compare Strings
I'll try that! thank you all very much
DK |
All times are GMT +1. The time now is 02:40 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com