+ Reply to Thread
Results 1 to 3 of 3

Working WIth Dates

  1. #1
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Office 365
    Posts
    371

    Working WIth Dates

    On my worksheet, the user enters a date into cell A1. Suppose he enters "05/24" and tabs out. It is assumed the date is 2022-05-24.
    My worksheet selection change code reformats that cell to display "May-24 (Tue)", which is correct. We'll use May 24, 2022 for the example for the remainder of this question.

    Variable svcDate is declared as date. It's value after the user enters the valid date of May 24 equals 2022-05-24.

    I have this code:
    Please Login or Register  to view this content.
    After it is executed, dt = 2024-05-22. Not only is that the wrong date, but it's not formatted as desired. I was really expecting the result of dt = 24-May-22. What am I doing wrong here?

    Moving forward, I want to use the value of dt as a component of a string.
    Please Login or Register  to view this content.
    To result in a value of strfn of "WS_24-May_22.xlsx". With my code dealing with variable dt, will I get the results I'm looking for? Or will I need to set dt differently? I'm not sure I can put a date variable into a string concatenation.

  2. #2
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Office 365
    Posts
    371

    Re: Working WIth Dates

    Dim dt as string

  3. #3
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,386

    Re: Working WIth Dates

    Yes indeed.

    Change event:

    Please Login or Register  to view this content.
    In a normal Module:

    Please Login or Register  to view this content.
    Last edited by JEC.; 05-21-2022 at 11:40 AM.

+ 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. NETWORK DATES, Dates and Times Working In Unison...
    By EduardStoo in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-08-2018, 04:32 AM
  2. [SOLVED] Formula to return the 'earliest' and 'latest' dates from a list of dates is not working
    By Hawkmoth1 in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 03-21-2017, 07:14 AM
  3. [SOLVED] Working with specific dates against Week Commencing dates
    By daveb86 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-11-2015, 05:36 AM
  4. Replies: 9
    Last Post: 03-08-2013, 11:50 AM
  5. Help Working Out Relative Dates and Non Working Days
    By leungf in forum Excel General
    Replies: 0
    Last Post: 08-07-2012, 12:06 PM
  6. [SOLVED] Working Dates and Off Dates Formula
    By jettechfsr in forum Excel General
    Replies: 5
    Last Post: 08-26-2011, 11:36 PM
  7. Replies: 7
    Last Post: 01-16-2009, 05: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