View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
R Storey R Storey is offline
external usenet poster
 
Posts: 2
Default Macro to Find and Replace

Thanks to both of you, both options work fantastically!!!

"Dave Peterson" wrote:

I would insert a helper column and use a formula like:

=U1-DAY(U1)+1
drag it down the column
Copy and paste special|values over column U and delete that helper column.

R Storey wrote:

I have recorded a macro to find and replace all the dates but when I run it
it doesn't actually change them. I want to change all the dates so that they
are all the 1st of the the month instead of specifying the day. I can't think
of an easier way of doing it so if anyone has any better ideas it'll be very
appreciated!!!

Here's the code:

Columns("U:U").Select
Selection.Replace What:="??/12/2005", Replacement:="01/12/2005",
LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False
Selection.Replace What:="??/01/2006", Replacement:="01/01/2006",
LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False
Selection.Replace What:="??/02/2006", Replacement:="01/02/2006",
LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False
Selection.Replace What:="??/03/2006", Replacement:="01/03/2006",
LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False

It doesn't come up with an error, it just doesn't do it!

Thanks in advance!!!!


--

Dave Peterson