Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Dynamic File Name Referencing

Hey guys, Hoping someone can get back to me with this one.

The problem i have is I have created a macro such that a file is saved
using the following command:

ActiveWorkbook.SaveAs Filename:=Range("Sourcefile).Value &
Format(Date, "mmdd")

which should give me a file named Sourcefile1007.xls

The issue I have is using the same referance within another workbooks.
I want a cell to referance/equal sourcefile(mmdd)sheetx!A1.

I am unable to successfully write a function which will add the mmdd
values and return the correct cell value.

Any help would be greatly appreciated.

Thanks,

Luke

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Dynamic File Name Referencing

Luke

Can you try this instead?:
ActiveWorkbook.SaveAs Filename:=Range("Sourcefile).Value &
Format(Month(XX),"00")& Format(Day(XX),"00")

Where XX is the reference to your date value.

B.R,
Faisal...

On Oct 30, 10:20 am, wrote:
Hey guys, Hoping someone can get back to me with this one.

The problem i have is I have created a macro such that a file is saved
using the following command:

ActiveWorkbook.SaveAs Filename:=Range("Sourcefile).Value &
Format(Date, "mmdd")

which should give me a file named Sourcefile1007.xls

The issue I have is using the same referance within another workbooks.
I want a cell to referance/equal sourcefile(mmdd)sheetx!A1.

I am unable to successfully write a function which will add the mmdd
values and return the correct cell value.

Any help would be greatly appreciated.

Thanks,

Luke



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Dynamic File Name Referencing

try this

Sub test()

Const path = "c:\temp\"
Const sourcefile = "abc"

Const mydate As Date = "1/1/07"

stringdate = Format(mydate, "mmdd")
Filename = sourcefile & stringdate & ".xls"
myformula = "='[" & Filename & "]sheetx'!A1"

Range("B1").Formula = myformula

End Sub

" wrote:

Hey guys, Hoping someone can get back to me with this one.

The problem i have is I have created a macro such that a file is saved
using the following command:

ActiveWorkbook.SaveAs Filename:=Range("Sourcefile).Value &
Format(Date, "mmdd")

which should give me a file named Sourcefile1007.xls

The issue I have is using the same referance within another workbooks.
I want a cell to referance/equal sourcefile(mmdd)sheetx!A1.

I am unable to successfully write a function which will add the mmdd
values and return the correct cell value.

Any help would be greatly appreciated.

Thanks,

Luke


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
Dynamic referencing to files Sungibungi Excel Discussion (Misc queries) 4 November 26th 09 02:19 AM
Dynamic linking or referencing of cells karthik Excel Programming 2 August 13th 07 09:18 PM
Dynamic file referencing? [email protected] Excel Worksheet Functions 1 October 9th 06 09:08 PM
referencing a dynamic array hke[_13_] Excel Programming 0 October 31st 04 06:33 PM
referencing a dynamic array hke[_12_] Excel Programming 1 October 29th 04 04:42 PM


All times are GMT +1. The time now is 04:53 AM.

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

About Us

"It's about Microsoft Excel"