procainestart
procainestart Dork
10/20/11 6:17 p.m.

My Excel kung-fu is bad, like, not even a white belt.

I have a client-provided template that I cannot use VBA in. I'd like to insert the total number of worksheets into a cell, like &[Pages] in a footer. Is there a way?

Thanks...

stafford1500
stafford1500 GRM+ Memberand New Reader
10/21/11 8:35 a.m.

what version of excel?? pre 2007 is reasonably different than 2007+

jrw1621
jrw1621 SuperDork
10/21/11 8:44 a.m.

I know the 2005 is different that the 2006
'05 '06

szeis4cookie
szeis4cookie Reader
10/21/11 9:48 a.m.

I don't know of a way to do this without VBA. Could you write a function that does this, and then preps your file for the client by copy/pasting all your data into a new file (i.e. sans code)? I am taking a similar approach with a VBA spreadsheet right now, as the final output from my process needs to be a tab-delimited text file.

procainestart
procainestart Dork
10/21/11 10:19 a.m.

Office 2010.

Maybe I could use the VBA, then copy/paste the data only, save as a standard xlsx file, not macro-enabled, and deliver to client...

stafford1500
stafford1500 GRM+ Memberand New Reader
10/21/11 1:11 p.m.

You can use an external workbook that does contain the code do the work and post it to the customers workbbok. Here's a quick example:
Sub Process_AWT()
CodeBook = ThisWorkbook.Name'this is the workbook containing the code
ReportBook = ActiveWorkbook.Name'this is the customer workbook

ReportSheetCount=ReportBook.Worksheets.Count

This can be very useful as all of the power can be kept in a container workbook and called when needed from the working document, without having to add code to a bunch of documents.

Steve Stafford

You'll need to log in to post.

Our Preferred Partners
o8nwAGT4qxnNSx0bckm3J0hjyh7eq2gngXYpnMQtpELjFWKZQMa96SkFfCiae9uM