Solved

Excel Macro - change date to current date

Posted on 2013-02-05
1
200 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

828 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