CONTAINS SPECIFIC TEXT OR NUMBER
Is there a way to test a cell for a specific text or number? Lets say a cell
contents of cell A1 begins with the word <Check, how would I test for that? -- D.S. |
CONTAINS SPECIFIC TEXT OR NUMBER
One way:
Dim bCheck As Boolean bCheck = Range("A1").Text Like "Check*" another: Dim bCheck As Boolean bCheck = Left(Range("A1").Text, 5) = "Check" note these are case sensitive. To make them case insensitive, you can do something like: Dim bCheck As Boolean bCheck = UCase(Range("A1").Text) Like "CHECK*" In article , "D.S." wrote: Is there a way to test a cell for a specific text or number? Lets say a cell contents of cell A1 begins with the word <Check, how would I test for that? |
CONTAINS SPECIFIC TEXT OR NUMBER
Thank you, I knew about the 'Left' function, I knew there was another and
couldn't remember what it was. Kept thinking it was some like 'contains'. 'Like' should work splendidly. Thanks again "JE McGimpsey" wrote in message ... One way: Dim bCheck As Boolean bCheck = Range("A1").Text Like "Check*" another: Dim bCheck As Boolean bCheck = Left(Range("A1").Text, 5) = "Check" note these are case sensitive. To make them case insensitive, you can do something like: Dim bCheck As Boolean bCheck = UCase(Range("A1").Text) Like "CHECK*" In article , "D.S." wrote: Is there a way to test a cell for a specific text or number? Lets say a cell contents of cell A1 begins with the word <Check, how would I test for that? |
All times are GMT +1. The time now is 06:11 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com