View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
John[_89_] John[_89_] is offline
external usenet poster
 
Posts: 1
Default Find & Replace Macro from external spreadsheet/db?

Hello.

I currently have a Macro which replaces numbers in all cells in column
A from row 3 onwards with different numbers.

I would like to change the Macro so that instead of having all the
replacements within the macro itself, it instead takes them from
another Spreadsheet called numberchanges.xls on drive C. It would be
a lot easier for me to maintain and update this way.

I need a little help with making this Macro though as I'm not an
expert with this sort of stuff.

Below shows three lines of the present Macro and the replacements it
makes:

Columns(1).Replace What:="1143", Replacement:="7945",
LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False

Columns(1).Replace What:="6762", Replacement:="4760",
LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False

Columns(1).Replace What:="70775", Replacement:="90001",
LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False

In the numberchanges.xls file I have this information in columns A and
B from row 3 onwards.

So 1143 is in cell A3 and it's replacement 7945 is in cell B3 and so
on until the last value.

How would I go about making the macro so that it opens the
numberchanges file and makes the replacements in the current document?

Would it be easier if I made an Access database file for it to find
and replace the data from? Or would you be able to do it via some
sort of query?

Cheers for any help

John