Groups

    Custom header Excel help

    I'm using

    =TODAY()-(INT(RAND()*3)+1) in an Excel cell.

    What I want to be able to do is have that cell content to appear in the left section of custom header rather than &[Date]. Is it possible, because I can't get it to work.

    4 Comments

    I'm not clear on what you mean by cell content.


    If you want to see the formula, completely clear the cell, format it as text, and paste the formula in. Alternatively, as a handy shortcut, insert a space before the =.

    If you want to see the number, format the cell as a number.

    If you're trying to copy the cell value, afaik there's no way to do that with formatting or formula, and you'll need to set up a quick macro to copy/paste as values, and then set your header to be ="Header blah "&=D11, where D11 is where the values-only pasting of your cell is placed.

    Original Poster

    The formula chooses a random date up to 3 days prior to today. I want that SAME random date to appear in the header. So it's cell value and it does seem to be a macro I need. I've never created a macro for this kind of thing. Can I create it so it automatically runs when I choose to print?

    random number generator needs to be refreshed to produce a new random number so you will need a macro to recalculate every time you print i believe.

    OllieSt

    The formula chooses a random date up to 3 days prior to today. I want … The formula chooses a random date up to 3 days prior to today. I want that SAME random date to appear in the header. So it's cell value and it does seem to be a macro I need. I've never created a macro for this kind of thing. Can I create it so it automatically runs when I choose to print?



    Yep.

    Afaik, you can't trigger a macro to run by printing a doc, but you can trigger a printjob as part of a macro, so you'd basically need a macro which does the following things

    1) Copy from cell where you have rand date value
    2) Paste to cell as values
    3) Print

    Iirc, you can do this in seconds by using the Record Macro function. You may have to manually write the Print function, but that shouldn't take you long. Use Google to help you find the specifics on how to do these things with your version of Excel.
    Edited by: "dxx" 11th Jul
    Post a comment
    Avatar
    @
      Text
      Top Discussions
      1. Microsoft approve Hyperkin's remake of the OG Xbox controller33
      2. word association Game73944536
      3. 75% off Sky TV for existing customers. Only works when you call the specifi…17846380
      4. So Brexit isn't going how a lot of Brexiters thought it would2149

      See more discussions