Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Change Formula Name

I am looking for a macro that can update formulas with
the current month. The simplest use would be to update a
formula that last month referenced last month to a
formula that now reference the current month. Example:
Last Month the formula = [REPORT JUN 04.xls]SHEET1'!A1.
This month I want the formula updated to = [REPORT JUL
04.xls]SHEET1'!A1.

I am trying to use a simple "Find & Replace"
and/or "Links Change" plus code that Tom Ogilvy wrote.
But I can 't get either to work. In the "Find & Replace"
I am using variations (for Date format "mmm yy":

Cells.Select
Selection.Replace What:=Today()-1), Replacement:=today
(),LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False

And it creates a syntax error. With Links Change I
get "Argument Not Optional" error on .ChangeLink Name:=

Thanks to all that have helped and any additional help
will be very much appreciated.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Change Formula Name


try: flexfind from JanKarel Pieterse

http://www.jkp-ads.com/OfficeMarketPlaceFF-EN.htm

--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


ronbo wrote :

I am looking for a macro that can update formulas with
the current month. The simplest use would be to update a
formula that last month referenced last month to a
formula that now reference the current month. Example:
Last Month the formula = [REPORT JUN 04.xls]SHEET1'!A1.
This month I want the formula updated to = [REPORT JUL
04.xls]SHEET1'!A1.

I am trying to use a simple "Find & Replace"
and/or "Links Change" plus code that Tom Ogilvy wrote.
But I can 't get either to work. In the "Find & Replace"
I am using variations (for Date format "mmm yy":

Cells.Select
Selection.Replace What:=Today()-1), Replacement:=today
(),LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False

And it creates a syntax error. With Links Change I
get "Argument Not Optional" error on .ChangeLink Name:=

Thanks to all that have helped and any additional help
will be very much appreciated.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Change Formula Name

from help the format is:

ActiveWorkbook.ChangeLink "c:\excel\book1.xls", _
"c:\excel\book2.xls", xlExcelLinks


so for you:

Dim sNew as String, sOld as String

sNew = "c:\myfolder\REPORT " & format(DateSerial( _
year(date),Month(date),1),"mmm yy") & ".xls"
sOld = "c:\myfolder\REPORT " & format(DateSerial( _
year(date),Month(date)-1,1),"mmm yy") & ".xls"

ActiveWorkbook.ChangeLink sOld, sNew, xlExcelLinks


--
Regards,
Tom Ogilvy


"ronbo" wrote in message
...
I am looking for a macro that can update formulas with
the current month. The simplest use would be to update a
formula that last month referenced last month to a
formula that now reference the current month. Example:
Last Month the formula = [REPORT JUN 04.xls]SHEET1'!A1.
This month I want the formula updated to = [REPORT JUL
04.xls]SHEET1'!A1.

I am trying to use a simple "Find & Replace"
and/or "Links Change" plus code that Tom Ogilvy wrote.
But I can 't get either to work. In the "Find & Replace"
I am using variations (for Date format "mmm yy":

Cells.Select
Selection.Replace What:=Today()-1), Replacement:=today
(),LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False

And it creates a syntax error. With Links Change I
get "Argument Not Optional" error on .ChangeLink Name:=

Thanks to all that have helped and any additional help
will be very much appreciated.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
change formula in a shared worksheet without losing change history DCE Excel Worksheet Functions 5 July 25th 08 01:37 PM
how to change formula in shared sheet without loss of change histo DCE Excel Worksheet Functions 1 July 23rd 08 05:09 PM
change color of all cells with formula or are part of a formula [email protected] Excel Discussion (Misc queries) 19 January 28th 08 01:21 AM
copy formula down a column and have cell references change within formula brad New Users to Excel 5 May 13th 07 04:38 PM
How does Data Validation change with a formula change? MayClarkOriginals Excel Worksheet Functions 3 July 5th 06 04:50 AM


All times are GMT +1. The time now is 07:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"