PC Review


Reply
Thread Tools Rate Thread

comparing text strings

 
 
CG Rosén
Guest
Posts: n/a
 
      24th Sep 2007
Good morning Group,

In the code below there is problem with the validation.
The Listbox1.Value is a text string like "a" or "b" etc. The
c.Value looks sometimes like "a,b,c,d". How to find out that
the Listbox1.Value is a part of the c.Value text string.

Grateful for hints how to approach the problem.

CG Rosén

---------------------------------------------------------------------------------------

Dim c as Range

For Each c In Sheets("Sheet1").Range("A1:A100")

If c.Value = Me.ListBox1.Value Then

Item1 = c.Value
Item2 = c.Offset(0, 1).Value

UserForm1.ListBox2.AddItem Item1
UserForm1.ListBox2.List(ListBox1.ListCount - 1, 1) = Item2

End If

Next c



 
Reply With Quote
 
 
 
 
=?Utf-8?B?U3RlZmk=?=
Guest
Posts: n/a
 
      24th Sep 2007
Try this:
If InStr(1, c.Value, Listbox1.Value) > 0 Then

Regards,
Stefi


„CG Rosén†ezt Ã*rta:

> Good morning Group,
>
> In the code below there is problem with the validation.
> The Listbox1.Value is a text string like "a" or "b" etc. The
> c.Value looks sometimes like "a,b,c,d". How to find out that
> the Listbox1.Value is a part of the c.Value text string.
>
> Grateful for hints how to approach the problem.
>
> CG Rosén
>
> ---------------------------------------------------------------------------------------
>
> Dim c as Range
>
> For Each c In Sheets("Sheet1").Range("A1:A100")
>
> If c.Value = Me.ListBox1.Value Then
>
> Item1 = c.Value
> Item2 = c.Offset(0, 1).Value
>
> UserForm1.ListBox2.AddItem Item1
> UserForm1.ListBox2.List(ListBox1.ListCount - 1, 1) = Item2
>
> End If
>
> Next c
>
>
>
>

 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      24th Sep 2007
If Me.ListBox1.Value Like "*" & c.Value & "*" Then

or

If Instr(c.Value, Me.ListBox1.Value)> 0 Then

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"CG Rosén" <(E-Mail Removed)> wrote in message
news:bTJJi.9539$(E-Mail Removed)...
> Good morning Group,
>
> In the code below there is problem with the validation.
> The Listbox1.Value is a text string like "a" or "b" etc. The
> c.Value looks sometimes like "a,b,c,d". How to find out that
> the Listbox1.Value is a part of the c.Value text string.
>
> Grateful for hints how to approach the problem.
>
> CG Rosén
>
> ---------------------------------------------------------------------------------------
>
> Dim c as Range
>
> For Each c In Sheets("Sheet1").Range("A1:A100")
>
> If c.Value = Me.ListBox1.Value Then
>
> Item1 = c.Value
> Item2 = c.Offset(0, 1).Value
>
> UserForm1.ListBox2.AddItem Item1
> UserForm1.ListBox2.List(ListBox1.ListCount - 1, 1) = Item2
>
> End If
>
> Next c
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing text strings Comparing columns with text Microsoft Excel Worksheet Functions 5 28th Nov 2009 07:43 PM
Comparing text strings in cells =?Utf-8?B?QW5keQ==?= Microsoft Excel Misc 0 11th Jan 2006 10:38 AM
Comparing text strings in cells =?Utf-8?B?QW5keQ==?= Microsoft Excel Misc 0 7th Dec 2005 04:17 PM
Comparing strings rossum Microsoft C# .NET 4 25th Jun 2005 02:34 AM
Comparing text strings, obtaining a percentage match! =?Utf-8?B?TWFyayBTdGVwaGVuc29u?= Microsoft Access Form Coding 1 17th Aug 2004 03:25 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:15 AM.