LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default VBA for comparing sequences of characters.

Hello!

I would like to know how can I write a VBA macro to execute the
following.
Given two strings of characters having the same length, I need a
function that compares each couple of characters in the same position
of the initial strings and gives back as a result a string equal to the
first input string but with the characters, that are different compared
with input string number two, written in bold font.

Example:

string1: A B C D E F
string2: A B C W E F

result of the formula: A B C [bold]D E F

since the first positions are both A, the second positions are both B,
the third are both C, the fifth are both E and the sixth are both F.
BUT the fourth positions differ, and so I can highlight that in string
1 there is the fourth position changed.

How can I write the code? I can easily use the Mid function to extract
the characters in each position, under a loop with "i" changing from 1
to the length of the sequences (with the Len function). But I don't
know how to change the style of the font if the character is different
between string1 and string2...

Can somebody help me?

Thank you very much!!!

Antonio Riva.

 
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
If Statement with 9 sequences Daisy77 Excel Discussion (Misc queries) 1 April 7th 10 06:01 PM
Comparing the first 2 characters of a coloumn to a string Jaime Excel Worksheet Functions 1 April 16th 08 06:28 AM
Comparing characters in one cell to multiple cells Quirthanon Excel Worksheet Functions 1 August 30th 07 03:38 AM
Save as: sequences? Ray Excel Discussion (Misc queries) 0 July 11th 06 03:29 PM
Event Sequences Nigel[_6_] Excel Programming 6 February 16th 04 03:30 PM


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

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

About Us

"It's about Microsoft Excel"