Solved

Excel Macro - change date to current date

Posted on 2013-02-05
1
214 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

751 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