Chris The Rock
Active Member
- Joined
- Feb 24, 2002
- Messages
- 287
My brain is fried. Between VBA and SQL, sometimes I can't remember how to do certain things, like this:
I want to set a boolean variable = TRUE if any of the following conditions are met:
IF a cell's value contains "PCT" ,
OR
IF that cell's value contains "%",
OR
IF that cell's value contains "PERCENT"
I know how to use INSTR to find out if a string is found in another string, I just can't wrap my head around using 3 criteria. Sounds like the perfect time to use SELECT CASE, but I can't think of how it should go.
Here's how I'd code it if I only was looking for a single one of these criteria:
Can I use "OR", like in SQL? Or is there a smarter way to do this?
I want to set a boolean variable = TRUE if any of the following conditions are met:
IF a cell's value contains "PCT" ,
OR
IF that cell's value contains "%",
OR
IF that cell's value contains "PERCENT"
I know how to use INSTR to find out if a string is found in another string, I just can't wrap my head around using 3 criteria. Sounds like the perfect time to use SELECT CASE, but I can't think of how it should go.
Here's how I'd code it if I only was looking for a single one of these criteria:
Code:
If InStr(1, UCase(rng_NewTarget.Value), "PCT") <> 0 Then
bln_IsPCT = True
End If
Can I use "OR", like in SQL? Or is there a smarter way to do this?