Does anyone know the code to put a number in the right header...

G

Guest

Does anyone know the code to put a number in the right header and have the
number change everytime you print? This number has nothing to do with the
worksheet itself, it is a totally different number.

This is what I am using to do the regular printing in the spreadsheet and
would like it to be changed for the right header only no cell reference:

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

Thanks sorry for the double post but I haven't received an answer to help me.
Jennifer
 
G

Guest

Thanks Gary for your input but it still does not work. I changed "jenny" to
my worksheet name and now I get an error. What am I doing wrong?
 
G

Gord Dibben

Don't change "jenny" to your worksheet name.

"jenny" is the custom property you are adding to File Properties.


Gord Dibben MS Excel MVP
 
G

Guest

Thanks for your reply. I entered it in exactly as you said and it shows it on
the print preview but still does not add a number every time I print. Any
solution?? Sorry for bugging you, I guess I need to take a class on this.
Thanks,
Jennifer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top