Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Does anyone know the code to put a number in the right header and.

have it change everytime you print. I got a great answer last time in the
cell format, but now I need to put it in the header part.

This is what I am using to do the regular printing:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
ActiveSheet.Range("K1").Value = ActiveSheet.Range("K1").Value + 1
End If
End Sub

I am still learning and would like to know how to change it to the right
header.
Thanks,
Jennifer
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,339
Default Does anyone know the code to put a number in the right header and.

try:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
ActiveSheet.PageSetup.RightHeader = ActiveSheet.Range("K1").Value + 1
End If
End Sub


"Jennifer-Houston, TX" wrote:

have it change everytime you print. I got a great answer last time in the
cell format, but now I need to put it in the header part.

This is what I am using to do the regular printing:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
ActiveSheet.Range("K1").Value = ActiveSheet.Range("K1").Value + 1
End If
End Sub

I am still learning and would like to know how to change it to the right
header.
Thanks,
Jennifer

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Does anyone know the code to put a number in the right header and.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name < "Sheet1" Then GoTo whoops
With ActiveSheet
.Range("K1").Value = .Range("K1").Value + 1
.PageSetup.RightHeader = Range("K1").Value
End With
Exit Sub
whoops:
MsgBox "wrong sheet, switch to sheet1"
Cancel = True
End Sub


Gord Dibben MS Excel MVP

On Tue, 14 Aug 2007 12:02:02 -0700, Jennifer-Houston, TX
wrote:

have it change everytime you print. I got a great answer last time in the
cell format, but now I need to put it in the header part.

This is what I am using to do the regular printing:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
ActiveSheet.Range("K1").Value = ActiveSheet.Range("K1").Value + 1
End If
End Sub

I am still learning and would like to know how to change it to the right
header.
Thanks,
Jennifer


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Does anyone know the code to put a number in the right header and.

I'm not sure if it's important, but you can print a sheet when it's not active.

When I want to do this, I'll create a dedicated macro that prints the sheet and
plop a button on that sheet so the user has to print using that button. (And
disable any other printing.)

Jennifer-Houston, TX wrote:

have it change everytime you print. I got a great answer last time in the
cell format, but now I need to put it in the header part.

This is what I am using to do the regular printing:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
ActiveSheet.Range("K1").Value = ActiveSheet.Range("K1").Value + 1
End If
End Sub

I am still learning and would like to know how to change it to the right
header.
Thanks,
Jennifer


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 709
Default Does anyone know the code to put a number in the right header

This code should only be for the header and has nothing to do with the cells
of the normal worksheet. How would the code change? Thanks a million

"Toppers" wrote:

try:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
ActiveSheet.PageSetup.RightHeader = ActiveSheet.Range("K1").Value + 1
End If
End Sub


"Jennifer-Houston, TX" wrote:

have it change everytime you print. I got a great answer last time in the
cell format, but now I need to put it in the header part.

This is what I am using to do the regular printing:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
ActiveSheet.Range("K1").Value = ActiveSheet.Range("K1").Value + 1
End If
End Sub

I am still learning and would like to know how to change it to the right
header.
Thanks,
Jennifer

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
what code pulls in contents of a cell in an Excel header/footer? Ronnyk Excel Discussion (Misc queries) 3 September 13th 07 08:18 PM
Convert a Number Code to a Text Code Traye Excel Discussion (Misc queries) 3 April 6th 07 09:54 PM
VBA Code to Add the same header from my first sheet into 20 sheets [email protected] Excel Worksheet Functions 4 December 15th 06 02:13 AM
how can i put a unique number in a header for a git certificat for Konstantine Excel Discussion (Misc queries) 2 April 15th 05 05:51 AM
How do i number pages in a header consequently JRD Excel Worksheet Functions 2 January 23rd 05 05:07 PM


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