+ Reply to Thread
Results 1 to 10 of 10

Extract Month Name from Date in VBA

  1. #1
    Forum Contributor
    Join Date
    05-26-2016
    Location
    India
    MS-Off Ver
    Microsoft 2021
    Posts
    324

    Smile Extract Month Name from Date in VBA

    Hello
    How Can I extract the month name (e.g NOV) from today date in vba
    for example, I want to Extract the month name from today date in Cell B1
    In cell B2 "Salary" is already written
    then how can I concatenate it as ( Nov Salary) in A1

    appreciate if someone helps, thanks in advance

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,384

    Re: Extract Month Name from Date in VBA

    Try
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,865

    Re: Extract Month Name from Date in VBA

    Please Login or Register  to view this content.
    Edit: Trevor types faster!
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,384

    Re: Extract Month Name from Date in VBA

    @Alan: yes, but I got the cell reference wrong. Should be B2, as you have put, rather than B1 (which we don't need)

    Corrected:
    Please Login or Register  to view this content.

  5. #5
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,408

    Re: Extract Month Name from Date in VBA

    Quote Originally Posted by alansidman View Post
    Please Login or Register  to view this content.
    You can compact this line of code by eliminating the concatenation of the space character and embedding the space in the pattern string directly...
    Please Login or Register  to view this content.
    I would note two things though...

    1) The OP seemed to indicate he wanted the abbreviated month name, so your "mmmm" should probably be "mmm".

    2) The OP seemed to indicate he wanted the abbreviated month name in all caps.

    Taking both of these into account, I would suggest changing your code line to this...
    Please Login or Register  to view this content.
    Last edited by Rick Rothstein; 11-23-2020 at 06:25 PM.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,384

    Re: Extract Month Name from Date in VBA

    @Rick: But then
    ... then how can I concatenate it as ( Nov Salary) in A1

  7. #7
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,408

    Re: Extract Month Name from Date in VBA

    @TMS: Good point (missed that)! With the original post and my post, the OP should be able to figure out how to make the month name abbreviation display however he wants.

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,384

    Re: Extract Month Name from Date in VBA

    @Rick: yes, he has a range of options to choose from.

    However, the one thing we have all been consistent about is the structure of the code and the function to use. Can't say fairer than that .

    I must admit that I always forget about using Format to add spaces

  9. #9
    Forum Contributor
    Join Date
    05-26-2016
    Location
    India
    MS-Off Ver
    Microsoft 2021
    Posts
    324

    Re: Extract Month Name from Date in VBA

    thanks all for the various options ... problem resolved

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,384

    Re: Extract Month Name from Date in VBA

    You're welcome. Thanks for the rep.

+ 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. I can't get the Month to extract from a date
    By USAOz in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-29-2020, 07:57 PM
  2. Replies: 5
    Last Post: 01-24-2019, 05:30 PM
  3. [SOLVED] Extract Year, Month, Day from date
    By stoicy in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-28-2016, 11:48 PM
  4. Extract Year, Month, Day from date
    By stoicy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-28-2016, 01:41 PM
  5. Extract birthday date and month
    By grey_hair in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-02-2011, 12:09 PM
  6. Extract Month from date IE 3/10/2010 = 3
    By randell.graybill in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-12-2010, 12:30 AM
  7. extract the month of a date
    By gireesh in forum Excel General
    Replies: 11
    Last Post: 11-23-2005, 02:10 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