Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default custom Header-Automated

Hello,
I have a custome header Example,
(REGION) - REPORT NAME PERIOD X, 2004

So before I print, I have to fill in what region Example
NA, EUROPE Or ASIA, plus what period I'm doing.
Is it possible to use a macro to fill the region and
period instead of doing manually to the menu toolbar,
Format/header/footers?

Not sure if I'm clear.
Please advise any info.

Thank you,

Juan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default custom Header-Automated

Hi Juan
if the region is in cell A1 and the period in cell B1 of your sheet try
the following macro. Put it in your workbook module (not in an standard
module):

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet
Dim head_str
For Each wkSht In Me.Worksheets
head_str = wkSht.range("A1").value & _
" - REPORT NAME PERIOD " & _
wkSht.range("B1").value & ", 2004"
With wkSht.PageSetup
.CenterHeader = head_str
End With
end with
Next wkSht
End Sub



--
Regards
Frank Kabel
Frankfurt, Germany


juan wrote:
Hello,
I have a custome header Example,
(REGION) - REPORT NAME PERIOD X, 2004

So before I print, I have to fill in what region Example
NA, EUROPE Or ASIA, plus what period I'm doing.
Is it possible to use a macro to fill the region and
period instead of doing manually to the menu toolbar,
Format/header/footers?

Not sure if I'm clear.
Please advise any info.

Thank you,

Juan


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default custom Header-Automated

Hello Frank,
thanks, but I think I wasnt' clear. The custom header I
go to Page setup and there's a tab to put custom
headers/footers. So I guess before user prints, they
would have to manually go to Page Setup and go to the
HEADER/FOOTER tab and just type in the region and period.
Thanks for the info. But if you understand what I'm
trying to do please provide info. Thanks alot.

juan
-----Original Message-----
Hi Juan
if the region is in cell A1 and the period in cell B1 of

your sheet try
the following macro. Put it in your workbook module (not

in an standard
module):

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet
Dim head_str
For Each wkSht In Me.Worksheets
head_str = wkSht.range("A1").value & _
" - REPORT NAME PERIOD " & _
wkSht.range("B1").value & ", 2004"
With wkSht.PageSetup
.CenterHeader = head_str
End With
end with
Next wkSht
End Sub



--
Regards
Frank Kabel
Frankfurt, Germany


juan wrote:
Hello,
I have a custome header Example,
(REGION) - REPORT NAME PERIOD X, 2004

So before I print, I have to fill in what region

Example
NA, EUROPE Or ASIA, plus what period I'm doing.
Is it possible to use a macro to fill the region and
period instead of doing manually to the menu toolbar,
Format/header/footers?

Not sure if I'm clear.
Please advise any info.

Thank you,

Juan


.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default custom Header-Automated

Hi
yes this is the manual way. But you asked for a macro solution :-)
The macro from my previous post will allow to just put these values
(region, period) in a cell on your worksheet (or use existing cells)
and automatically fill themn into the header/footer directly before you
print this site.

So have you tried the macro?


--
Regards
Frank Kabel
Frankfurt, Germany


Juan wrote:
Hello Frank,
thanks, but I think I wasnt' clear. The custom header I
go to Page setup and there's a tab to put custom
headers/footers. So I guess before user prints, they
would have to manually go to Page Setup and go to the
HEADER/FOOTER tab and just type in the region and period.
Thanks for the info. But if you understand what I'm
trying to do please provide info. Thanks alot.

juan
-----Original Message-----
Hi Juan
if the region is in cell A1 and the period in cell B1 of your sheet
try the following macro. Put it in your workbook module (not in an
standard module):

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet
Dim head_str
For Each wkSht In Me.Worksheets
head_str = wkSht.range("A1").value & _
" - REPORT NAME PERIOD " & _
wkSht.range("B1").value & ", 2004"
With wkSht.PageSetup
.CenterHeader = head_str
End With
end with
Next wkSht
End Sub



--
Regards
Frank Kabel
Frankfurt, Germany


juan wrote:
Hello,
I have a custome header Example,
(REGION) - REPORT NAME PERIOD X, 2004

So before I print, I have to fill in what region Example
NA, EUROPE Or ASIA, plus what period I'm doing.
Is it possible to use a macro to fill the region and
period instead of doing manually to the menu toolbar,
Format/header/footers?

Not sure if I'm clear.
Please advise any info.

Thank you,

Juan


.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default custom Header-Automated

Hello Frank,
thanks. No haven't tried macro will do. I do appreciate
all the help you have provided me.

Thanks alot.

juan
-----Original Message-----
Hi
yes this is the manual way. But you asked for a macro

solution :-)
The macro from my previous post will allow to just put

these values
(region, period) in a cell on your worksheet (or use

existing cells)
and automatically fill themn into the header/footer

directly before you
print this site.

So have you tried the macro?


--
Regards
Frank Kabel
Frankfurt, Germany


Juan wrote:
Hello Frank,
thanks, but I think I wasnt' clear. The custom header I
go to Page setup and there's a tab to put custom
headers/footers. So I guess before user prints, they
would have to manually go to Page Setup and go to the
HEADER/FOOTER tab and just type in the region and

period.
Thanks for the info. But if you understand what I'm
trying to do please provide info. Thanks alot.

juan
-----Original Message-----
Hi Juan
if the region is in cell A1 and the period in cell B1

of your sheet
try the following macro. Put it in your workbook

module (not in an
standard module):

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet
Dim head_str
For Each wkSht In Me.Worksheets
head_str = wkSht.range("A1").value & _
" - REPORT NAME PERIOD " & _
wkSht.range("B1").value & ", 2004"
With wkSht.PageSetup
.CenterHeader = head_str
End With
end with
Next wkSht
End Sub



--
Regards
Frank Kabel
Frankfurt, Germany


juan wrote:
Hello,
I have a custome header Example,
(REGION) - REPORT NAME PERIOD X, 2004

So before I print, I have to fill in what region

Example
NA, EUROPE Or ASIA, plus what period I'm doing.
Is it possible to use a macro to fill the region and
period instead of doing manually to the menu toolbar,
Format/header/footers?

Not sure if I'm clear.
Please advise any info.

Thank you,

Juan

.


.

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
custom header ct_pws_3 New Users to Excel 3 March 11th 09 04:28 PM
Can you link a custom property to an Excel custom header text? LouErc Setting up and Configuration of Excel 0 November 8th 05 04:58 PM
Excel: custom header - is it possible to paste into header? Maureen D. Excel Worksheet Functions 0 November 4th 05 03:07 PM
how do I permanetly add custom header to excel header list? GARY Excel Discussion (Misc queries) 1 December 15th 04 08:52 PM
Custom Header Josh O. Excel Discussion (Misc queries) 1 December 1st 04 06:56 PM


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