Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel macro help

I need help in creating a macro that will compare two columns of text.
Essentially, I need this macro to look at column A and for whatever column A
is, to look in column B for an expected answer. If the answer given isn't
part of the list of variables, I need a result screen.

So if in column A I have the word 'CAR', and the acceptable variables for
'CAR' are "red", "green" and "blue", but in Column B the result is "FORD", I
need to have that line highlighted. Sorry if this doesn't make a lot of
sense, too little sleep, too much tea!

Thanks,
Jean
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Excel macro help

Depends on setting up the Select case, you could do select Cases nested
instead of if statements. Depends on how complicated your data is in
actuality.
Sub RightInfo()
'Start in column "B" on the first data element to compare to
' "A", will run till it runs out of data
Do Until ActiveCell.Value = ""
BValue = ActiveCell.Value
AValue = ActiveCell.Offset(0, -1).Value
Select Case AValue
Case "Car"
If BValue = "Red" Or BValue = "Green" Then
'Do nothing
Else
With Selection.Interior
.ColorIndex = 36
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
End If
Case Else

End Select
ActiveCell.Offset(1, 0).Select
Loop
End Sub

Hope this will help.
David
"Jean D." wrote:

I need help in creating a macro that will compare two columns of text.
Essentially, I need this macro to look at column A and for whatever column A
is, to look in column B for an expected answer. If the answer given isn't
part of the list of variables, I need a result screen.

So if in column A I have the word 'CAR', and the acceptable variables for
'CAR' are "red", "green" and "blue", but in Column B the result is "FORD", I
need to have that line highlighted. Sorry if this doesn't make a lot of
sense, too little sleep, too much tea!

Thanks,
Jean

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
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 3 February 5th 07 08:22 PM
translate lotus 1-2-3 macro into excel macro using excel 2000 krutledge0209 Excel Programming 1 November 2nd 04 05:50 PM


All times are GMT +1. The time now is 07:14 AM.

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"