Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display spreadsheet cell data as footer for chart 4

Status
Not open for further replies.

macajm

Mining
Jun 5, 2001
26
Does anyone know how to display info from a spreadsheet cell as part of a header or footer on a chart (or anywhere else an a chart for that matter)?
 
Replies continue below

Recommended for you

macajm:

As far as I know, the only way you might be able to do this is by writing a macro. Say you wanted the left portion of the footer to display the text in cell "A1". Assuming the sheet's name is "Sheet1" you would need the following code:

Worksheets("Sheet1").PageSetup.LeftFooter = Range("A1").Value

Similarly, there are Left, Right, and Center header & footer properties.

An easy way to get the format you want is to record a macro and format the header / footer with the text you want displayed. Next, you can go edit out the text you typed and insert the links to your information (like for cell "A1" above)

If you need any help, let me know.

Good luck!

jproj
 
jproj,

Works like a charm! I've needed this before but always got stuck thinking there must be a way to do this from the custom footer dialog (i.e., using an &code or something). Note, also, you can put your footer-altering code in a BeforePrint event handler to automatically update the footer info.

Btw, I often record a macro to use as a starting point for complicated or unfamiliar actions.

Regards,
M. Smith
 
TO jproj -
Thanks for your idea which I implemented as follows:-
Sub SSdata_toChart()
' Macro recorded 29/04/2002
' Puts contents of Cell A1 into Footer
With ActiveChart.PageSetup
.LeftFooter = Range("a1")
End With
End Sub


To M.Smith -
How do you create a "BeforePrint" event handler?
 
macajm,

With the VBA Editor open, highlight ThisWorkbook in the Project window. Click on the View Code button (leftmost button at top of Project window). Select Workbook from the lefthand drop-down in the Code window (this will initially show General) then BeforePrint in the righthand drop-down. This will create an empty event handler procedure. Drop your code in and it will run prior to printing. Good Luck!

M. Smith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor