Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Michelle
 
Posts: n/a
Default Adding a formula to the header

I need to create a spreadsheet that takes the data in cell K10 and places it
in the right section of the header.

If this is a macro solution I am not highly skilled in them so as much info
as possible is appreciated.

Thanks in advance.
Michelle
  #2   Report Post  
Posted to microsoft.public.excel.misc
Sloth
 
Posts: n/a
Default Adding a formula to the header

Taking from the help - "You cannot insert graphics or cell references in a
header or footer. Use print titles if you want to repeat cell contents or a
graphic on every printed page."

that being said you can use this macro to change the header. Right click on
the sheet tab and click View Code. Right click on ThisWorkbook and click
Insert-Module. Insert this code in Module1...

Sub Macro1()
ActiveSheet.PageSetup.RightHeader = Cells(10, 11)
End Sub

you can then link this macro to a button. When you run the macro, it will
change the header for you according to cell K10. I know there is a way to
trigger a macro like this when you save, or when you print. Unfortunately,
my experience is quite limited, and I don't know how.

"Michelle" wrote:

I need to create a spreadsheet that takes the data in cell K10 and places it
in the right section of the header.

If this is a macro solution I am not highly skilled in them so as much info
as possible is appreciated.

Thanks in advance.
Michelle

  #3   Report Post  
Posted to microsoft.public.excel.misc
Sloth
 
Posts: n/a
Default Adding a formula to the header

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.RightHeader = Cells(10, 11)
End Sub

insert this code in "ThisWorkbook". It will trigger when you hit print, or
print preview.

"Sloth" wrote:

Taking from the help - "You cannot insert graphics or cell references in a
header or footer. Use print titles if you want to repeat cell contents or a
graphic on every printed page."

that being said you can use this macro to change the header. Right click on
the sheet tab and click View Code. Right click on ThisWorkbook and click
Insert-Module. Insert this code in Module1...

Sub Macro1()
ActiveSheet.PageSetup.RightHeader = Cells(10, 11)
End Sub

you can then link this macro to a button. When you run the macro, it will
change the header for you according to cell K10. I know there is a way to
trigger a macro like this when you save, or when you print. Unfortunately,
my experience is quite limited, and I don't know how.

"Michelle" wrote:

I need to create a spreadsheet that takes the data in cell K10 and places it
in the right section of the header.

If this is a macro solution I am not highly skilled in them so as much info
as possible is appreciated.

Thanks in advance.
Michelle

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Adding a formula to the header

This works well. I modified your suggestion to this:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.CenterFooter = Cells(62, 7)*100
End Sub

However, my value is looks like "53.486752138958". What should I add to
make the result look like "53%"?

Thanks in advance.


"Sloth" wrote:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.RightHeader = Cells(10, 11)
End Sub

insert this code in "ThisWorkbook". It will trigger when you hit print, or
print preview.

"Sloth" wrote:

Taking from the help - "You cannot insert graphics or cell references in a
header or footer. Use print titles if you want to repeat cell contents or a
graphic on every printed page."

that being said you can use this macro to change the header. Right click on
the sheet tab and click View Code. Right click on ThisWorkbook and click
Insert-Module. Insert this code in Module1...

Sub Macro1()
ActiveSheet.PageSetup.RightHeader = Cells(10, 11)
End Sub

you can then link this macro to a button. When you run the macro, it will
change the header for you according to cell K10. I know there is a way to
trigger a macro like this when you save, or when you print. Unfortunately,
my experience is quite limited, and I don't know how.

"Michelle" wrote:

I need to create a spreadsheet that takes the data in cell K10 and places it
in the right section of the header.

If this is a macro solution I am not highly skilled in them so as much info
as possible is appreciated.

Thanks in advance.
Michelle

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Adding a formula to the header

I'd use:

with ActiveSheet
.PageSetup.CenterFooter = format(.Cells(62, 7).value / 100, "#%")
end with



bbarkman wrote:

This works well. I modified your suggestion to this:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.CenterFooter = Cells(62, 7)*100
End Sub

However, my value is looks like "53.486752138958". What should I add to
make the result look like "53%"?

Thanks in advance.

"Sloth" wrote:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.RightHeader = Cells(10, 11)
End Sub

insert this code in "ThisWorkbook". It will trigger when you hit print, or
print preview.

"Sloth" wrote:

Taking from the help - "You cannot insert graphics or cell references in a
header or footer. Use print titles if you want to repeat cell contents or a
graphic on every printed page."

that being said you can use this macro to change the header. Right click on
the sheet tab and click View Code. Right click on ThisWorkbook and click
Insert-Module. Insert this code in Module1...

Sub Macro1()
ActiveSheet.PageSetup.RightHeader = Cells(10, 11)
End Sub

you can then link this macro to a button. When you run the macro, it will
change the header for you according to cell K10. I know there is a way to
trigger a macro like this when you save, or when you print. Unfortunately,
my experience is quite limited, and I don't know how.

"Michelle" wrote:

I need to create a spreadsheet that takes the data in cell K10 and places it
in the right section of the header.

If this is a macro solution I am not highly skilled in them so as much info
as possible is appreciated.

Thanks in advance.
Michelle


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Adding a formula to the header

ActiveSheet.PageSetup.CenterFooter = Format((Cells(62, 7) * 100), "#,##0")


Gord Dibben MS Excel MVP


On Mon, 5 Jan 2009 07:31:01 -0800, bbarkman
wrote:

This works well. I modified your suggestion to this:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.CenterFooter = Cells(62, 7)*100
End Sub

However, my value is looks like "53.486752138958". What should I add to
make the result look like "53%"?

Thanks in advance.


"Sloth" wrote:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.RightHeader = Cells(10, 11)
End Sub

insert this code in "ThisWorkbook". It will trigger when you hit print, or
print preview.

"Sloth" wrote:

Taking from the help - "You cannot insert graphics or cell references in a
header or footer. Use print titles if you want to repeat cell contents or a
graphic on every printed page."

that being said you can use this macro to change the header. Right click on
the sheet tab and click View Code. Right click on ThisWorkbook and click
Insert-Module. Insert this code in Module1...

Sub Macro1()
ActiveSheet.PageSetup.RightHeader = Cells(10, 11)
End Sub

you can then link this macro to a button. When you run the macro, it will
change the header for you according to cell K10. I know there is a way to
trigger a macro like this when you save, or when you print. Unfortunately,
my experience is quite limited, and I don't know how.

"Michelle" wrote:

I need to create a spreadsheet that takes the data in cell K10 and places it
in the right section of the header.

If this is a macro solution I am not highly skilled in them so as much info
as possible is appreciated.

Thanks in advance.
Michelle


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
Adding Contents of a cell to a formula Paul Bond Excel Discussion (Misc queries) 10 January 25th 06 04:43 PM
Adding the contents of a cell to a formula Paul Bond Excel Discussion (Misc queries) 1 January 21st 06 07:19 PM
Adding something to a complicated formula Roz Excel Discussion (Misc queries) 6 December 20th 05 09:00 PM
formula adding cells in worksheets when # of sheets in work book changes klatimer Excel Discussion (Misc queries) 0 December 14th 05 05:53 PM
Formula for adding several worksheet totals karatefem Excel Discussion (Misc queries) 9 August 19th 05 03:47 AM


All times are GMT +1. The time now is 06:31 PM.

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"