+ Reply to Thread
Results 1 to 2 of 2

Fix date problem in macro

  1. #1
    Registered User
    Join Date
    02-09-2017
    Location
    USA
    MS-Off Ver
    2016
    Posts
    4

    Fix date problem in macro

    Capture.JPG

    I am trying to create a macro that updates a pivot table and then groups the dates by month and year, but I am getting an error. How do I fix this so that '1/1/1900' is whatever date that is first in the pivot table?

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Fix date problem in macro

    You will probably have to go "off pivot table" for this. Somewhere on the sheet do a MIN() function on the source data for the date of interest. Set this to a variable, say MinDate and then use the following code.

    Please Login or Register  to view this content.
    You might have to put a single quote around that (CHR(27)).

    Please Login or Register  to view this content.
    If you don't want to go off table then consider Application.WorksheetFunction.MIN(Range_with_the_Date)
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [solved] macro date comparision problem
    By Jmanorris39 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-02-2012, 10:36 AM
  2. Macro date problem
    By Pedro1803 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-31-2011, 04:06 PM
  3. Date problem in Macro
    By qazqaz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-20-2010, 06:37 PM
  4. Problem with Date in macro
    By rbyrd023 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-14-2010, 01:34 PM
  5. Birtish Vs American date Macro problem
    By damo_uk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-14-2009, 11:42 AM
  6. Macro Changes Date format problem from txt
    By tek9step in forum Excel General
    Replies: 2
    Last Post: 07-06-2009, 09:22 AM
  7. my saveas macro date problem
    By Nigel in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 09-16-2005, 02:05 PM
  8. Date problem in Macro
    By SMILE in forum Excel General
    Replies: 0
    Last Post: 01-05-2005, 03:04 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1