Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to compare only a PART of strings?
Greetings:
I have two cells of text which are identical, except that one of the cells has been truncated after 255 characters. The other cell contains the full text. Looking for some VBA code to compare the first 255 characters to confirm equality, and if they are equal, then take some action: If {first 255 of cell A1} = {first 255 of cell A2} Then .. .. Else .. .. End If How do I get VBA to look at only the first 255 characters of the text and ignore the rest? Help is appreciated. Thanks, MARTY |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to compare only a PART of strings?
Hi Marty,
Use the LEFT() function. Assume A1 is the truncated cell. If Range("A1") = LEFT{Range("A2"),255) Then Cheers Andy Marty wrote: Greetings: I have two cells of text which are identical, except that one of the cells has been truncated after 255 characters. The other cell contains the full text. Looking for some VBA code to compare the first 255 characters to confirm equality, and if they are equal, then take some action: If {first 255 of cell A1} = {first 255 of cell A2} Then . . Else . . End If How do I get VBA to look at only the first 255 characters of the text and ignore the rest? Help is appreciated. Thanks, MARTY -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to compare only a PART of strings?
Perfect. Thanks, Andy!
-----Original Message----- Hi Marty, Use the LEFT() function. Assume A1 is the truncated cell. If Range("A1") = LEFT{Range("A2"),255) Then Cheers Andy Marty wrote: Greetings: I have two cells of text which are identical, except that one of the cells has been truncated after 255 characters. The other cell contains the full text. Looking for some VBA code to compare the first 255 characters to confirm equality, and if they are equal, then take some action: If {first 255 of cell A1} = {first 255 of cell A2} Then . . Else . . End If How do I get VBA to look at only the first 255 characters of the text and ignore the rest? Help is appreciated. Thanks, MARTY -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help With Searching For Strings In Part Numbers | Excel Worksheet Functions | |||
Compare Strings | Excel Discussion (Misc queries) | |||
Compare two strings | Excel Worksheet Functions | |||
Compare the strings | Excel Discussion (Misc queries) | |||
Compare cells/columns and highlight matching text strings | Excel Worksheet Functions |