Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
simple code with "abc" & "*"
Hi al,
I have this line of code: If Range(Cells(commentrij, 43), Cells(commentrij, 43)).Text = "abc" & "*" Then The cell contains abc followed by some other characters (depending on the row) but this line will not work. If I use the complete text of the content of the cell, e.g. "abcdef", the line of code works properly. I guess "abc" & "*" is incorrect, but I don't know why. What shoud it be? Thanks in advance for your help. Jack Sons The Netherlands |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
simple code with "abc" & "*"
Wildcards don't work with this simple comparison.
You could use like: if range(...).text like "abc*" then or you could check the first 3 characters: if left(range(...).text, 3) = "abc" then ps. You don't need that .range(...) stuff--it's a single cell: if cells(commentrij,43).text like .... Jack Sons wrote: Hi al, I have this line of code: If Range(Cells(commentrij, 43), Cells(commentrij, 43)).Text = "abc" & "*" Then The cell contains abc followed by some other characters (depending on the row) but this line will not work. If I use the complete text of the content of the cell, e.g. "abcdef", the line of code works properly. I guess "abc" & "*" is incorrect, but I don't know why. What shoud it be? Thanks in advance for your help. Jack Sons The Netherlands -- Dave Peterson |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
simple code with "abc" & "*"
Dave,
Response fast as lightning and very helpful, as always, thank you. Jack. "Dave Peterson" schreef in bericht ... Wildcards don't work with this simple comparison. You could use like: if range(...).text like "abc*" then or you could check the first 3 characters: if left(range(...).text, 3) = "abc" then ps. You don't need that .range(...) stuff--it's a single cell: if cells(commentrij,43).text like .... Jack Sons wrote: Hi al, I have this line of code: If Range(Cells(commentrij, 43), Cells(commentrij, 43)).Text = "abc" & "*" Then The cell contains abc followed by some other characters (depending on the row) but this line will not work. If I use the complete text of the content of the cell, e.g. "abcdef", the line of code works properly. I guess "abc" & "*" is incorrect, but I don't know why. What shoud it be? Thanks in advance for your help. Jack Sons The Netherlands -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
change "true" and "false" to "availble" and "out of stock" | Excel Worksheet Functions | |||
HELP on "left","right","find","len","substitute" functions | Excel Discussion (Misc queries) | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel | |||
Complex if test program possible? If "value" "value", paste "value" in another cell? | Excel Discussion (Misc queries) |