Solved

Excel Macro - change date to current date

Posted on 2013-02-05
1
194 Views
Last Modified: 2013-02-20
have a macro that when it was recorded it put the recorded date in column P (Today). I need to modify the macro so that to puts the run date (today's date) every time it's runs?

  Range("P1").Select
    ActiveCell.FormulaR1C1 = "Today"
    Range("P2").Select
    ActiveCell.FormulaR1C1 = "11/6/2012"

so currently Today date shows 11/6/2012 I need it to be today's date if I run it today.

Thanks,
0
Comment
Question by:shland
1 Comment
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 500 total points
ID: 38857185
No need for the Selects.

Range("p1") = "Today"
With Range("p2")
    .Value = Date
    .NumberFormat = "mm/dd/yyyy"
End With

Open in new window

0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question