Solved

Excel Macro - change date to current date

Posted on 2013-02-05
1
176 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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
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…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now