The macro adds the word "through" and puts parentheses around the sum of transactions. As written, the macro would create a footer that looked similar to this:Īgain, the actual appearance depends on the formatting in cells E1, E2, and E3. Third, the macro ends up setting up the footer in the sTemp variable. Since you are working with dates and sums, this is the approach you want to use, so it is what was used in the macro. In other words, sTemp will be equal to whatever is in cell E1, as it is formatted in the cell. The third approach is different it sets sTemp equal to the formatted text of the cell. The first two approaches are equivalent they set sTemp equal to the contents of the cell. STemp = Worksheets("Sheet1").Range("E1").Text STemp = Worksheets("Sheet1").Range("E1").Value There are actually three ways you could reference the cell contents, as shown here: First of all, the macro only sets the footer information in the worksheet named Sheet1, though you can change this worksheet name to whatever you need. There are a few things to note in this macro. Private Sub Workbook_BeforePrint(Cancel As Boolean) In that case, you could use a macro like this: Let's assume, for the sake of this approach, that your start date is contained in cell E1, your ending date is in cell E2, and your total of transactions are in cell E3.
You can, however, use a macro to set your footer. There is no built-in way to do this in Excel because formulas cannot be entered into footers they aren't recognized as formulas by the program. He wonders if there is a way to get a formula into the footer so it can reflect these values.
He would like to have a footer for the printed page that incorporates these three pieces of data, dynamically. One cell contains a start date, the second contains an ending date, and the third contains a total for the transactions between those dates. Skye has three cells on a worksheet that are important.