Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Excel Macro - change date to current date

Posted on 2013-02-05
1
Medium Priority
?
236 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 93

Accepted Solution

by:
Patrick Matthews earned 2000 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

661 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