ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find & Replace w/ name change (https://www.excelbanter.com/excel-programming/304529-find-replace-w-name-change.html)

ronbo

Find & Replace w/ name change
 
I have a workbook that I use month to month named "Report
MTH YY" This month the report is named "Report Jul 04".
Next month the report will be renamed "Report Aug 04",
then "Report Sep 04" etc.

I have formulas that reference last months report. As
simple as " ='[REPORT Jun 04.xls]Sheet 1'!A1". Next
month in "Report Aug 04" I want the formula to reference
the Jul report i.e. ='[REPORT Jul 04.xls]Sheet 1'!A1" .

I am looking for a way to automate the process rather
than manually using "Find & Replace", but I do not know
how to get the month names to change automatically.

Thanks for any help.


Tom Ogilvy

Find & Replace w/ name change
 
If the workbook you are retrieving values from is always open, you can use
indirect

=Indirect("'[Report " & Text(Date(Year(today()),Month(Today())-1,1),"mmm
yy") & ".xls]Sheet1'!A1")

--
Regards,
Tom Ogilvy

"ronbo" wrote in message
...
I have a workbook that I use month to month named "Report
MTH YY" This month the report is named "Report Jul 04".
Next month the report will be renamed "Report Aug 04",
then "Report Sep 04" etc.

I have formulas that reference last months report. As
simple as " ='[REPORT Jun 04.xls]Sheet 1'!A1". Next
month in "Report Aug 04" I want the formula to reference
the Jul report i.e. ='[REPORT Jul 04.xls]Sheet 1'!A1" .

I am looking for a way to automate the process rather
than manually using "Find & Replace", but I do not know
how to get the month names to change automatically.

Thanks for any help.




ronbo

Find & Replace w/ name change
 

-----Original Message-----
If the workbook you are retrieving values from is always

open, you can use
indirect

=Indirect("'[Report " & Text(Date(Year(today()),Month

(Today())-1,1),"mmm
yy") & ".xls]Sheet1'!A1")

--
Regards,
Tom Ogilvy

"ronbo" wrote in

message
...
I have a workbook that I use month to month

named "Report
MTH YY" This month the report is named "Report Jul 04".
Next month the report will be renamed "Report Aug 04",
then "Report Sep 04" etc.

I have formulas that reference last months report. As
simple as " ='[REPORT Jun 04.xls]Sheet 1'!A1". Next
month in "Report Aug 04" I want the formula to

reference
the Jul report i.e. ='[REPORT Jul 04.xls]Sheet 1'!A1" .

I am looking for a way to automate the process rather
than manually using "Find & Replace", but I do not know
how to get the month names to change automatically.

Thanks for any help.




.
Thanks for the help. However, the previous workbook is

never opened with the new month. Is is in the same
directory. Any other ideas???



Tom Ogilvy

Find & Replace w/ name change
 
You said:
As simple as " ='[REPORT Jun 04.xls]Sheet 1'!A1".


Which is the formula to link to an open workbook.

So by being imprecise, you wasted a lot of time.

Indirect doesn't work with a closed workbook. You could write a UDF that
starts a new instance of excel, opens the workbook, extracts the data,
closes the workbook and closes the new instance of excel on each recalc of
each instance of the function.

Or you could write a macro that uses the workbook_open event to check the
link and change it when it doesn't match the current month.

--
Regards,
Tom Ogilvy


"ronbo" wrote in message
...

-----Original Message-----
If the workbook you are retrieving values from is always

open, you can use
indirect

=Indirect("'[Report " & Text(Date(Year(today()),Month

(Today())-1,1),"mmm
yy") & ".xls]Sheet1'!A1")

--
Regards,
Tom Ogilvy

"ronbo" wrote in

message
...
I have a workbook that I use month to month

named "Report
MTH YY" This month the report is named "Report Jul 04".
Next month the report will be renamed "Report Aug 04",
then "Report Sep 04" etc.

I have formulas that reference last months report. As
simple as " ='[REPORT Jun 04.xls]Sheet 1'!A1". Next
month in "Report Aug 04" I want the formula to

reference
the Jul report i.e. ='[REPORT Jul 04.xls]Sheet 1'!A1" .

I am looking for a way to automate the process rather
than manually using "Find & Replace", but I do not know
how to get the month names to change automatically.

Thanks for any help.




.
Thanks for the help. However, the previous workbook is

never opened with the new month. Is is in the same
directory. Any other ideas???






All times are GMT +1. The time now is 11:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com