+ Reply to Thread
Results 1 to 5 of 5

VBA format function

  1. #1
    Forum Contributor
    Join Date
    06-19-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Office365
    Posts
    276

    VBA format function

    I got an error message using:

    Set desWB = Workbooks(Format(DateAdd("m", -1, Date), "0m") & "02 Ele Cap.xlsx")

    I need to set the workbook to:

    05-02 Ele Cap.xlsx

    please help...

    thanks,

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: VBA format function

    Hi lynnsong986,

    Try this:

    Please Login or Register  to view this content.
    Note you need to wrap any code you post with the appropriate tags as I have done like so [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] .

    Thanks,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  3. #3
    Forum Contributor
    Join Date
    06-19-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Office365
    Posts
    276

    Re: VBA format function

    Thanks so much, works like a charm as usual!! sorry I was in a rush, forgot to format it properly...

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,962

    Re: VBA format function

    05-02 Ele Cap.xlsx

    seems you are missing the dash dash
    Ben Van Johnson

  5. #5
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: VBA format function

    Thanks so much, works like a charm
    Thanks for letting us know and you're welcome

+ 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. Replies: 5
    Last Post: 02-08-2013, 11:06 AM
  2. Macro function Get Comment Text function with format
    By guynextdoor in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-28-2010, 01:08 AM
  3. What function/format to use
    By emmab in forum Excel General
    Replies: 2
    Last Post: 03-27-2008, 06:41 AM
  4. [SOLVED] Problem with using Format( ) function on 1.25
    By Daveo in forum Excel General
    Replies: 6
    Last Post: 09-12-2005, 10:05 PM
  5. Format from function
    By adsa in forum Excel General
    Replies: 2
    Last Post: 06-16-2005, 02:05 PM
  6. Format NOW function
    By Todd Huttenstine in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-03-2005, 04:06 PM
  7. the function FORMAT()
    By Jonas in forum Excel General
    Replies: 1
    Last Post: 01-28-2005, 02:06 PM
  8. How to use Format function in VBA
    By lehainam in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-19-2005, 09:17 PM

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