Results 1 to 6 of 6

VBA : Date Format()

Threaded View

rossofoco VBA : Date Format() 04-15-2019, 07:45 AM
Greg M Re: VBA : Date Format() 04-15-2019, 07:34 PM
rossofoco Re: VBA : Date Format() 04-16-2019, 04:31 AM
BellyGas Re: VBA : Date Format() 04-16-2019, 06:37 AM
rossofoco Re: VBA : Date Format() 04-16-2019, 10:04 AM
Greg M Re: VBA : Date Format() 04-18-2019, 02:48 PM
  1. #1
    Registered User
    Join Date
    04-15-2019
    Location
    italy
    MS-Off Ver
    office 365
    Posts
    3

    VBA : Date Format()

    Dears,

    i hope that someone could help me to understand better why the following code does not function well.

    Sub weektodata()
    
    Dim xWs, xDWs As Worksheet
    Dim filtrodata, filtrodata2 As Date
    Dim iWeek, iYear As Integer
    xDStr = "Home"
    On Error Resume Next
    Set xDWs = Worksheets(xDStr)
    
      iWeek = xDWs.Cells(2, 4).Value
      iYear = 2019
      filtrodata = DateSerial(iYear, 1, ((iWeek - 1) * 7) + 2 - Weekday(DateSerial(iYear, 1, 1)) + 1)
      filtrodata2 = Format(filtrodata, "dd.MMM.aaaa")
      MsgBox (filtrodata)
        
    
    End Sub
    but if you the contets of the variable

    VBA.PNG

    Did I do something wrong? What am I missing?

    Thanks a lot.
    Rossofoco
    Last edited by rossofoco; 04-15-2019 at 07:52 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Converting from the 1904 date format to the 1900 date format without losing data
    By Patty McJorst in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-01-2020, 12:53 PM
  2. [SOLVED] Converting Date & Time (General format) to Date (Date format)
    By supremenuts in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-22-2017, 12:55 PM
  3. Replies: 4
    Last Post: 04-29-2015, 08:36 AM
  4. Date Format Of User PC Changes Display format date of Excel File after update
    By waihar in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-24-2014, 03:09 AM
  5. Replies: 5
    Last Post: 02-08-2013, 11:06 AM
  6. Need Formula/VBA Code to convert date in String Format to Normal Date format
    By Karthik Sen in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-18-2012, 04:54 AM
  7. Column Range with date Format MM/DD/YYYY independate of sys date Format
    By gaursh in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-18-2011, 03:31 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