How to add a forumla calculation to a footer

P

pokdbz

I have the following code. I need it to add the result of the formula to the
footer is there a different way I can do this because what I'm doing now
doesn't show up in the footer.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.LeftFooter = Date & " - " & Round((Date - 34448) /
7, 0) + 1
End Sub
 
B

Bernard Liengme

This works just fine for me so I wonder if you have placed the code in the
correct place.
This is a workBOOK sub so right click the Excel icon (next to File) on the
Excel menu bar (not the VB editor) and select View Code. This is where the
code should be
OR In VBEdtior click ThisWorkbook for the current workbook in the Project
window
best wishes
 
B

Bob Phillips

You need some data on the sheet for this to print.

I tried it and it showed 02/01/2008 - 715.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
D

Dave Peterson

Did you put this code under the ThisWorkbook module?

Did you allow macros to run when you opened the workbook?

Do you have your security settings set to high so that you don't even get
prompted to allow macros?

Did you want this footer applied to more than the activesheet?

ps. this won't help your problem, but it may be easier to understand your code
later:

ActiveSheet.PageSetup.LeftFooter _
= Date & " - " & Round((Date - dateserial(1994,4,24)) / 7, 0) + 1

Using those funny 5 digit numbers to represent are really confusing to me.
 

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