• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

After a macro pastes a cell with the =NOW() date function from an invoice sheet into a report sheet, how do I keep the original pasted date? |VBA & Macros|Excel Forum|My Online Training Hub

You are here: Home / After a macro pastes a cell with the =NOW() date function from an invoice sheet into a report sheet, how do I keep the original pasted date? |VBA & Macros|Excel Forum|My Online Training Hub

vba course banner

Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumVBA & MacrosAfter a macro pastes a cell with th…
sp_PrintTopic sp_TopicIcon
After a macro pastes a cell with the =NOW() date function from an invoice sheet into a report sheet, how do I keep the original pasted date?
Avatar
Brian Gingerich

Active Member
Members
Level 0
Forum Posts: 3
Member Since:
May 4, 2019
sp_UserOfflineSmall Offline
1
May 4, 2019 - 12:46 am
sp_Permalink sp_Print

This is the code I am using:

Sheets("Invoice").Select
Range("B12").Select
Selection.Copy
Sheets("Report").Select
erow = Sheet3.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Cells(erow, 5).Offset(-1, 0).Select
ActiveSheet.Paste

sp_AnswersTopicSeeAnswer See Answer
Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1529
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
2
May 6, 2019 - 9:55 pm
sp_Permalink sp_Print

Hi Brian,

The code you pasted doesn't have any call to NOW() in it?

If you are calling NOW() from your macro then just check that the cell where the result from NOW() goes isn't blank, and don't call NOW() again :

 

   If Range("A1") = "" Then

      Range("A1") = Now()

   End If

 

Regards

Phil

Avatar
Brian Gingerich

Active Member
Members
Level 0
Forum Posts: 3
Member Since:
May 4, 2019
sp_UserOfflineSmall Offline
3
May 7, 2019 - 10:42 pm
sp_Permalink sp_Print

Thanks kindly Phil, my apologies for the confusion I caused!

I have built an Excel invoice system that creates an invoice record for every client, saves it with that invoice number, then adds +1 to the invoice number & clears the form to ready it for the next client.

Just after the invoice saves in macro1, it copies & pastes certain fields of the invoice {for accounting purpose} in macro2, and places those cells into sheet3.

When it copies cell ("B12") which uses the =NOW() formula, it pastes it as the =NOW() formula {despite me not specifying to paste the actual value} so if you go into the report the next day, it displays the invoice date as that present day, not the original date of yesterday.

I am looking to add a command in the step2 macro to ensure the report date of that invoice record stays the same as the date it is posted.

Thanks very much for your help!!

Avatar
Velouria
London or thereabouts
Moderator
Members


Trusted Members

Moderators
Level 4
Forum Posts: 648
Member Since:
November 1, 2018
sp_UserOfflineSmall Offline
4
May 7, 2019 - 11:09 pm
sp_Permalink sp_Print

Replace all the code you posted with this:

With Sheet3
erow = .Cells(.Rows.Count, 1).End(xlUp).Row
.Cells(erow, 5).Value = Sheets("Invoice").Range("B12").Value
End With
sp_AnswersTopicAnswer
Answers Post
Avatar
Brian Gingerich

Active Member
Members
Level 0
Forum Posts: 3
Member Since:
May 4, 2019
sp_UserOfflineSmall Offline
5
May 8, 2019 - 10:08 pm
sp_Permalink sp_Print

Thankyou!

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: ash seth, Scott Miller
Guest(s) 11
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 873
Purfleet: 414
Frans Visser: 346
David_Ng: 306
lea cohen: 222
Jessica Stewart: 217
A.Maurizio: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
David du Toit
leandro barbarini
Melanie Ford
Isaac Felbah
Adele Glover
Hitesh Asrani
Rohan Abraham
Anthony van Riessen
Erlinda Eloriaga
Abisola Ogundele
Forum Stats:
Groups: 3
Forums: 24
Topics: 6356
Posts: 27795

 

Member Stats:
Guest Posters: 49
Members: 32326
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.