find & replace help

  • Thread starter Thread starter jasemhi
  • Start date Start date
J

jasemhi

How can I find cell A1 (all instances) in column C and replace them with
cell B1, then automatically find cell A2 (in all instances) and replace
them with cell B2, and so on until columns A and B are used up? I have
tried the macro, but this gets me no where. Please help!

Thanks,
Jason
 
Jason,

Dim findCell As Range

Set findCell = Range("A1")
On Error Resume Next
Do While Not IsEmpty(findCell)
Columns("C").Replace findCell, findCell.Offset(0,
1), xlWhole
Set findCell = findCell.Offset(1, 0)
Loop
On Error GoTo 0
Set findCell = Nothing


The On Error statement takes care of the cases of when
there are no matches.

Kevin Beckham
 
Thanks Kevin. How do I get started though? Is that VB script? Where do I
input the command? I am really new to the advanced featues of Excel,
but I am willing to learn. Do you have any good resources, books, etc.,
that you can point me to?

Much apreciated,
Jason
 
Back
Top