View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Lotus123 Lotus123 is offline
external usenet poster
 
Posts: 1
Default VB Macro to Automate a Search/Replace


Okay – I might be able to do this myself, but I seriously doubt I coul
do it quickly or a very good job of it since my VB skills are on th
bottom rung of the ladder. If someone here is interested and has som
free time, then I would greatly appreciate a helpful hand!

I need/want a VB Macro that does the following:
1) Knows the current date, for example 6/07/06, and converts this dat
to 0606 (MMYY), but then subtracts 1 month to make it 0506. It als
knows the previous month is MAY (MMM).
2) Based on step 1, it knows the second previous month is 0406. Jus
like in step one, it also knows the second previous month is APR.
3) Using the range I would have selected prior to running the macro, i
does the following search and replace:

Befo 2006\APR 2006\[dp-0406
After: 2006\MAY 2006\[dp-0506

4) The macro would also need to update the year at the beginning whe
we changed to a new year.

So what is this for? I have about 50 reports I prepare for 5
different external companies in which I have to manually do a searc
and replace of the above formulas each month. It only takes about 1
seconds to do it on each report, but it is one of those things that
know could be easily automated with a macro that I could put in m
personal.xls workbook.

Thanks in advance for your help

--
Lotus12
-----------------------------------------------------------------------
Lotus123's Profile: http://www.excelforum.com/member.php...fo&userid=2861
View this thread: http://www.excelforum.com/showthread.php?threadid=54951