Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Calling cell values from random sheets from a base sheet

I have a base sheet that needs to be able to be saved each month and
point to a separate file that will be saved each month. My final users
of this base sheet will not be able to get in and change the reference
to show a call from file datajan06.xls to datafeb06.xls, etc.... so
Data and .xls will always be the same, however the month and year will
need to change.

I would like to make a cell that says Jan06 and the user can change
that to Feb06 which will then tell the reference to change the file it
is pulling from ... ie. changes dataXXXXX.xls from datajan06.xls to
datafeb06.xls and thus changes the file it is pulling the data from...

I have used indirect to create a field reference to a field with a
formula of ="data"&Attendence!C1&".xls" so that if C1 on the attendence
page says Jan06 then the file is datajan06.xls.

This does not seem to translate into a working formula...

=IF(Attendence!B5="", "", '[dataXXXXX.xls]Sheet1'!$H3)

Any suggestions?

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,441
Default Calling cell values from random sheets from a base sheet

Ed,

INDIRECT will work, but you need the file referenced to be open to actually have the data extracted.

Otherwise, you could use the worksheet's change event.

The example code below assumes that you will type Feb06 into cell A1 to change the formulas of the
current sheet. Copy the code, right-click on the sheet tab, select "View Code" and paste the code
into the window that appears. You will also need a cell named OldFileName, and both that cell and
your cell for filedate entry need to be formatted for text. Also, the cell OldFileName should have
Jan06 (or whatever the current cell link is) entered into it prior to starting.

HTH,
Bernie
MS Excel MVP


Private Sub Worksheet_Change(ByVal Target As Range)
Dim myOldFileName As String
Dim myNewFileName As String

If Target.Address < "$A$1" Then Exit Sub

Application.EnableEvents = False

myOldFileName = Range("OldFileName").Text
myNewFileName = Target.Text


Cells.Replace What:=myOldFileName, _
Replacement:=myNewFileName, _
LookAt:=xlPart

Range("OldFileName").Value = "'" & myNewFileName
Application.EnableEvents = True

End Sub



wrote in message ups.com...
I have a base sheet that needs to be able to be saved each month and
point to a separate file that will be saved each month. My final users
of this base sheet will not be able to get in and change the reference
to show a call from file datajan06.xls to datafeb06.xls, etc.... so
Data and .xls will always be the same, however the month and year will
need to change.

I would like to make a cell that says Jan06 and the user can change
that to Feb06 which will then tell the reference to change the file it
is pulling from ... ie. changes dataXXXXX.xls from datajan06.xls to
datafeb06.xls and thus changes the file it is pulling the data from...

I have used indirect to create a field reference to a field with a
formula of ="data"&Attendence!C1&".xls" so that if C1 on the attendence
page says Jan06 then the file is datajan06.xls.

This does not seem to translate into a working formula...

=IF(Attendence!B5="", "", '[dataXXXXX.xls]Sheet1'!$H3)

Any suggestions?



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
Sumproduct issues SteveDB1 Excel Worksheet Functions 25 June 3rd 09 04:58 PM
Return Matched Numeric Values across Rows Sam via OfficeKB.com Excel Worksheet Functions 2 January 2nd 07 11:03 PM
Loop Macro a variable number of times thesaxonuk Excel Discussion (Misc queries) 11 October 31st 06 06:05 PM
Asked previously...can this not be done in excel simonsmith Excel Discussion (Misc queries) 2 May 16th 06 11:50 PM
Compiling macro based on cell values simonsmith Excel Discussion (Misc queries) 1 May 16th 06 08:31 PM


All times are GMT +1. The time now is 03:52 PM.

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"