View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JW[_2_] JW[_2_] is offline
external usenet poster
 
Posts: 638
Default Edit/Replace from table or named range?

This is hard-coded, but could easily be tweaked to accomodate
anything.
Sub foofer()
For i = 2 To 20
Sheets("mainSheet").Range(Cells(1, 1), Cells(Rows.Count,
1)).Replace _
What:=Sheets("Sheet2").Cells(i, 1), _
Replacement:=Sheets("Sheet2").Cells(i, 2), _
LookAt:=xlWhole, SearchOrder:=xlByRows, _
MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Next i
End Sub
Steve wrote:
Hello. I have a column of data in Sheet1, column A. I need to do a
bunch of Replaces on this data. Can vba refernece a table or named
range to loop through the Replaces? The table is on Sheet2, A2:B20.
Column A in the tabls is the "Find", and Col B is the "Replace with".
Thanks!