PDA

View Full Version : Searching for values in an in-string list.



kestrel1306
11-15-2017, 02:24 PM
Hi team,

I have a list box with about 900 entries entries in it.

For specific items (about 200 ~ 300 of them) I need a warning window to pop up.

I've got the test code done.

What I'm after is a better, tidier way to list the values I'm searching for as the search criteria THING_xx, as I've said will be 200 or 300 items.

The search text won't be sequential per my demo text (just to make life harder).

If push comes to shove, I might have to do a swag of these things :-(

Select Case True
Case (InStr(THING_List(), "(THING_01)") > 0), (InStr(THING_List(), "(THING_02)") > 0) , (InStr(THING_List(), "(THING_03)") > 0)
UserForm8.Label1123.Visible = True
UserForm8.Label1114.Visible = True
MsgBox "message box text.", , "MSGBOX TITLE"
End Select

As always your help is appreciated


Regards
Kes

macropod
11-15-2017, 05:07 PM
What, exactly, does THING_List() contain?

kestrel1306
11-15-2017, 09:05 PM
Hi Paul,

With THING_List
.portion_01 = "(5912)" 'This is the identifier line I'll be searching for...
.portion_02 = "1"
.portion_03 = "stuff"
End With
Addbits THING_List

Sorry if I'm vague, but it's quite propriety to the industry I'm in...


Regards
Kes

macropod
11-15-2017, 09:24 PM
Sorry if I'm vague, but it's quite propriety to the industry I'm in...
Indeed it is - I'm none the wiser as to how that relates to what you're trying to do. That said, maybe something along the lines of the following will get you started:

Dim lVal As Long
Select Case True
If InStr(THING_List(), "(THING_") > 0 Then
lVal = CLng(Split(Split(THING_List(), "(THING_")(1), ")")(0))
Select Case lVal
Case 1 - 100
UserForm8.Label1123.Visible = True
UserForm8.Label1114.Visible = True
MsgBox "message box text.", , "MSGBOX TITLE"
Case Else
End Select
End If
Case Else
End Select

kestrel1306
11-15-2017, 10:58 PM
Hi Paul,

Sorry for being so mysterious...

.portion_01 is essentially a 4 or 5 digit serial number. Either starting with either an alpha or a numeric.

It is totally non-sequential so would need to list the specific item somewhere (I think?)

I was wondering if it would be easier if I made a .portion_04 = "yes" or "no" and searching for that somehow...

I'm totally an amateur at this (as you've no doubt guessed)


Regards
Kes

macropod
11-15-2017, 11:23 PM
Sorry, but there just isn't enough meaningful content & context in what you've posted for me to make sense of what's going on.

kestrel1306
11-16-2017, 03:14 AM
Can you PM me at all? (unsure of the rules for that on here)


Kes

gmaxey
11-16-2017, 05:28 AM
I have a list box with about 900 entries entries in it.

For specific items (about 200 ~ 300 of them) I need a warning window to pop up.

How about just an simple example.

I have a list box with 5 items.

Tom
Dick
Harry
Moe
Curley

I need a warning to pop up when "WHAT"