is it possible to Restrict Find & Replace to 1 column

S

Simon

I need to Find and Replace values in a Column

Same data also exists in other columns - so I would like to restrict the
Find and Replace to
a specified column

I need to do this in a Macro ie. popup a text box
 
S

Simon

No, that dosen't work

Also replaces values that exist in other columns !

This is the Macro I recorder

Sub Macro2()
Columns("W:W").Select
Selection.Replace What:="740", Replacement:="989", LookAt:=xlWhole, _
SearchOrder:=xlByColumns, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub

Other columns with 740 in it are also replaced with 989
 
J

JE McGimpsey

Does for me. XL04, XL03.

Your macro works fine as well. Only replaces 740 in column W.


What happens when you don't select:

Sub Macro3()
Columns("W:W").Replace _
What:=740, _
Replacement:=989, _
LookAt:=xlWhole
End Sub
 
S

Simon

Thanks

Works ok with 2002 SP3


JE McGimpsey said:
Does for me. XL04, XL03.

Your macro works fine as well. Only replaces 740 in column W.


What happens when you don't select:

Sub Macro3()
Columns("W:W").Replace _
What:=740, _
Replacement:=989, _
LookAt:=xlWhole
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top