Thread: Compare columns
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
mathel mathel is offline
external usenet poster
 
Posts: 64
Default Compare columns

If the Interation is different on different PCs, could it be a factor? IE: I
verified the Options on the PC I'm using in the office, it shows Maximum 100,
I would have to check my PC that I use from home to see if there is a
difference.

On the other hand, there is 1 row I know is in both columns, and while
VLookUp did not find the row, I found the following piece of VB that 'showed'
the data. However, this code changes the text, rather than highlighting the
cell. Unfortunately I know nothing about VBA, so don't know how to modify it
so it would work to hightlight only - This example compares Column A to B in
the same worksheet:

Sub Replace_TExt()


For i = 1 To
ActiveSheet.Range("B:B").Cells.SpecialCells(xlCell TypeLastCell).Row

If Trim(ActiveSheet.Range("B" & i)) < "" Then

ActiveSheet.Range("A:A").Replace What:=ActiveSheet.Range("B" & i),
Replacement:=ActiveSheet.Range("B" & i).Value, _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:= _
False, ReplaceFormat:=False

End If

Next i
End Sub


--
Linda


"Joel" wrote:

If VLOOKUP isn't working I don't think VBA will be any better. There must be
something different with the data for VLOOKUP not to work. I would check the
Tools - options - Calculation menu to see what the number of Iterations is
set to. If the iteration n umber is set too low or you are set to manual
calculation this may be the cause of the problem.

"mathel" wrote:

I've checked thru the Discussion group and found this subject has been asked
several times, but can't find something I can use.

I am using Excel 2003 and have a wb with 2 sheets - 'Exposed' and
'Transactions'. I need to compare Column A in ws 'Transactions' to Column a
in ws 'Exposed'. If there is a match, have the data show on the same row in
Column b on ws 'Exposed'. The number of rows on both ws can vary anywhere
from 500 rows to as many as 5000. I know the simple answer is to use
VLOOKUP, unfortunately, there are multiple users (and PCs) using this wb and
for whatever reason the formula does NOT always work and the data is being
missed so I am looking for VBA.

Even if the data in Column A could not be put into Column B, I would be
happy if the cell was highlighted.

Thanks
--
Linda