Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help With Searching For Strings In Part Numbers tb Excel Worksheet Functions 3 June 21st 11 04:22 PM
Compare Strings dksaluki Excel Discussion (Misc queries) 4 October 18th 08 09:39 PM
Compare two strings andy62 Excel Worksheet Functions 8 September 6th 06 02:14 PM
Compare the strings yangyh Excel Discussion (Misc queries) 3 September 8th 05 04:45 AM
Compare cells/columns and highlight matching text strings luxbelle Excel Worksheet Functions 1 February 25th 05 06:34 PM


All times are GMT +1. The time now is 04:22 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"