Results 1 to 2 of 2

Thread: VBA date doesn't match with date in workbook
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Jul 2017
    Posts
    25
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default VBA date doesn't match with date in workbook

    Hi all,

    The format of the dates that I'm using are different although I both formatted them in the same way. I copied them to a cell in my workbook and the date that is visible in the cell and the date that is visible in the inputbox above the workbook stay different. It's like super frustrating. Please help.

    Thanks in advance.

    Code:
    M = 1
    
    
    For x = 16 To 27
    
    
    Cells(5, x) = DateSerial(2017, M, 1)
    Cells(5, x).NumberFormat = "dd/mm/yyyy"
    M = M + 1
    
    
    Next x
    
    
    
    
    Footerdate = Format(DateSerial(Year(Now()), Month(Now()), Day(Now())))
    Cells(1, 16).Value = Footerdate
    Cells(1, 16).NumberFormat = "dd/mm/yyyy"
    
    
    For x = 16 To 27
    
    
    
    
    If Cells(1, 16) = Cells(5, x) Then
    
    
    MsgBox "Check", vbOKOnly
    
    
    End If
    
    
    Next x

  2. #2
    Board Regular
    Join Date
    Nov 2013
    Location
    Denver, Colorado - XFD1048576 - MORE Stuff here near the end. And what if you add even more stuff a
    Posts
    617
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA date doesn't match with date in workbook

    Hello Strooprover - This LINK may help. Dates can be way confusing.
    Happy Excelling ,

    goesr

    To enter code in your post use the format below. Click the link for more detail.
    [CODE] ... Your Code Here ... [/CODE]

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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