Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default Referencing Inactive Workbook Cells

Good morning all

Hope someone can provide some help here. I have created a macro that takes a
specific worksheet from the workbook and saves it as its own workbook (code
shown below) referencing 2 cells in the worksheet as the filename.

Sub Savefile()

'opening workbook

ActiveSheet.Copy ' Copies active sheet to a new workbook
ActiveWorkbook.SaveAs Range("H6").Value & Range("H7")

End Sub

However, as part of the filename, I would also like to include a cell from a
different worksheet in the original workbook (location shown below)

workbook name: version2.xls
worksheet: MasterDMA
cell: E6

Please could someone provide advise on how to reference that cell as well
within the filename.

Thanks so much

Regards,
PVANS

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default Referencing Inactive Workbook Cells

set rng = WORKBOOKS("version2").Worksheets("MasterDMA").Rang e("E6")
ActiveWorkbook.SaveAs Range("H6").Value & Range("H7") & rng.Value

"PVANS" wrote in message
...
Good morning all

Hope someone can provide some help here. I have created a macro that takes
a
specific worksheet from the workbook and saves it as its own workbook
(code
shown below) referencing 2 cells in the worksheet as the filename.

Sub Savefile()

'opening workbook

ActiveSheet.Copy ' Copies active sheet to a new workbook
ActiveWorkbook.SaveAs Range("H6").Value & Range("H7")

End Sub

However, as part of the filename, I would also like to include a cell from
a
different worksheet in the original workbook (location shown below)

workbook name: version2.xls
worksheet: MasterDMA
cell: E6

Please could someone provide advise on how to reference that cell as well
within the filename.

Thanks so much

Regards,
PVANS

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Referencing Inactive Workbook Cells

Sub Savefile()

Dim strFile as String
strFile = WorkBooks("version2.xls").Sheets("MasterDMA").Rang e("E6")
ActiveSheet.Copy
ActiveWorkbook.SaveAs "c:\" & strFile & Range("H6").Value & Range("H7")
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"PVANS" wrote:

Good morning all

Hope someone can provide some help here. I have created a macro that takes a
specific worksheet from the workbook and saves it as its own workbook (code
shown below) referencing 2 cells in the worksheet as the filename.

Sub Savefile()

'opening workbook

ActiveSheet.Copy ' Copies active sheet to a new workbook
ActiveWorkbook.SaveAs Range("H6").Value & Range("H7")

End Sub

However, as part of the filename, I would also like to include a cell from a
different worksheet in the original workbook (location shown below)

workbook name: version2.xls
worksheet: MasterDMA
cell: E6

Please could someone provide advise on how to reference that cell as well
within the filename.

Thanks so much

Regards,
PVANS

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default Referencing Inactive Workbook Cells

Thanks Jacob

think I got it sorted now, thanks for the quick response

Regards,

"Jacob Skaria" wrote:

Sub Savefile()

Dim strFile as String
strFile = WorkBooks("version2.xls").Sheets("MasterDMA").Rang e("E6")
ActiveSheet.Copy
ActiveWorkbook.SaveAs "c:\" & strFile & Range("H6").Value & Range("H7")
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"PVANS" wrote:

Good morning all

Hope someone can provide some help here. I have created a macro that takes a
specific worksheet from the workbook and saves it as its own workbook (code
shown below) referencing 2 cells in the worksheet as the filename.

Sub Savefile()

'opening workbook

ActiveSheet.Copy ' Copies active sheet to a new workbook
ActiveWorkbook.SaveAs Range("H6").Value & Range("H7")

End Sub

However, as part of the filename, I would also like to include a cell from a
different worksheet in the original workbook (location shown below)

workbook name: version2.xls
worksheet: MasterDMA
cell: E6

Please could someone provide advise on how to reference that cell as well
within the filename.

Thanks so much

Regards,
PVANS

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
Referencing Cells in another worksheet in same workbook Robert[_32_] Excel Programming 5 April 20th 07 03:36 PM
Referencing Cells of Different Workbook Mike[_109_] Excel Programming 2 August 14th 06 06:13 PM
How do I save an Excel workbook so that cells referencing another. williejoeshaver Excel Discussion (Misc queries) 1 March 11th 05 09:44 PM
Referencing cells in another workbook Don Guillett[_4_] Excel Programming 1 August 31st 04 02:18 PM
Referencing cells in another workbook Tom Ogilvy Excel Programming 0 August 31st 04 02:08 PM


All times are GMT +1. The time now is 09:21 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"