Creating a Footer that contains the value of a cell on another Workbook

Claire Jones

New Member
Joined
Mar 23, 2009
Messages
3
Hi All :)

I am new to this forum (and to VBA) and am hoping you will be able to help me.

I am trying to find a way of putting the value of a cell from a specified sheet in one workbook into the footer of another sheet in another workbook.

The below works if you want the value of a cell in the same workbook but I can't figure out how to do if you want the value of a cell from a different workbook.

ActiveSheet.PageSetup.LeftFooter = Range("a1").Value

I tried the below but it did not work. Do you have any ideas?.

Private Sub Workbook_BeforePrint(Cancel As Boolean)

Dim ftr As String
Application.Workbooks("Book 1.xls").Worksheets("Sheet 1").Range("a1").Value = ftr
ActiveSheet.PageSetup.LeftFooter = ftr

End Sub

For the purpose of this lets say I want to put the value of range A1 on Sheet 1 of a workbook named "master" into the left footer of Sheet 1 in a workbook named "Specification 1".

Your help really would be most appreciated.

Many thanks, hope to hear from you soon.


Claire
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Welcome to the Board.

Try:

ActiveSheet.PageSetup.LeftFooter = Workbooks("Book 1.xls").Worksheets("Sheet 1").Range("A1").Value
 
Upvote 0

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
If you get that error you need to check that a workbook named "Book 1.xls" is open and that it contains a worksheet named "Sheet 1" (no quotes in both cases).
 
Upvote 0

Mark F

Well-known Member
Joined
Jun 7, 2002
Messages
504
Just a thought really

Is it definitely "Sheet 1" or could it be "Sheet1" ?

This is the type of thing thats gets me every time

Mark:)
 
Upvote 0

Forum statistics

Threads
1,191,379
Messages
5,986,281
Members
440,016
Latest member
vasanrajeswaran

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top