View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
graemeh graemeh is offline
external usenet poster
 
Posts: 4
Default Macro to select columns and replace data

Ron, I need it to step from column to column and do a replacement for each
coulmn as it goes. Currently I have 37 columns that I need to step do a
replacement command.


"Ron" wrote:

On Jul 8, 4:14 pm, graemeh wrote:
I want to loop through a range of colums and do a replacement like below. Is
there an easy way to do this via a marco?

Columns("AQ:AQ").Select
Selection.Replace What:="ap$", Replacement:="AQ$", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Columns("AR:AR").Select
Selection.Replace What:="ap$", Replacement:="Ar$", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False


This should work for you.
Columns("AQ").Replace What:=" ap$", Replacement:="AQ$",
LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False