+ Reply to Thread
Results 1 to 13 of 13

Entering Dates by typing the month number only

  1. #1
    Forum Contributor
    Join Date
    01-20-2014
    Location
    Greece
    MS-Off Ver
    20 yr. old Excel 2002!
    Posts
    710

    Entering Dates by typing the month number only

    Hi

    In a cell formatted as date (month-year) is it possible to:

    i.e enter "12":

    FORMULA BAR shows: Current Year-December-01 (since day not specified).
    The CELL shows: Dec-Current year (2 digit is fine).

    Thanks
    Last edited by drgkt; 01-05-2017 at 06:26 AM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Entering Dates by typing the month number only

    Hi

    You could only do that in the same cell with a Sheet Change macro which personally I think would be OTT

    Why not just enter the month number in a cell, say A1 and alongside in say B1 use the formula

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    and Custom format B2 to "mmm yy"
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Contributor
    Join Date
    01-20-2014
    Location
    Greece
    MS-Off Ver
    20 yr. old Excel 2002!
    Posts
    710

    Re: Entering Dates by typing the month number only

    I was looking not to add another column...
    How will the macro work,
    enter number, execute macro, go to next cell enter number, execute macro...?

  4. #4
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Entering Dates by typing the month number only

    Try in attached file first and then adapt this to suit your requirements
    To illustrate, 3 ranges are automatically changed from month number to "month-year"
    B2:B20 =2017 , E2:E20 = 2018, F2:F20 = 2016


    Place VBA in the relevant sheet module
    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    01-05-2017
    Location
    carrer rockledge
    MS-Off Ver
    2013
    Posts
    5

    Re: Entering Dates by typing the month number only

    Using Add-In A-Tools to view calendar (click to input date)
    2017-01-03 13_10_09-Book1 - Excel.png
    2017-01-03 13_10_32-Book1 - Excel.png

  6. #6
    Forum Contributor
    Join Date
    01-20-2014
    Location
    Greece
    MS-Off Ver
    20 yr. old Excel 2002!
    Posts
    710

    Re: Entering Dates by typing the month number only

    That's great Kev_!

    Suppose the target range is the entire column A and the year is current year. How do I modify the code?

    In VBA can things be "rem"ed out like in batch files? (Easier to modify the code by moving rems around instead of deleting and rewriting...)

  7. #7
    Forum Contributor
    Join Date
    01-20-2014
    Location
    Greece
    MS-Off Ver
    20 yr. old Excel 2002!
    Posts
    710

    Re: Entering Dates by typing the month number only

    Quote Originally Posted by thinhvd View Post
    Using Add-In A-Tools to view calendar (click to input date)
    This is what I have...
    Attached Images Attached Images

  8. #8
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Entering Dates by typing the month number only

    Try this
    All entries in Column A (below row 1) amended from month number to "month-2017"

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    01-20-2014
    Location
    Greece
    MS-Off Ver
    20 yr. old Excel 2002!
    Posts
    710

    Re: Entering Dates by typing the month number only

    Thanks!

    I guess NO REMs in VBA?

  10. #10
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Entering Dates by typing the month number only

    You are welcome

    In vba, these 2 lines are the same. The apostrophe is a shortcut for Rem
    Please Login or Register  to view this content.
    If you are happy with your solution, please go to Thread Tools (top of thread) and mark the thread as solved.
    thanks

  11. #11
    Forum Contributor
    Join Date
    01-20-2014
    Location
    Greece
    MS-Off Ver
    20 yr. old Excel 2002!
    Posts
    710

    Re: Entering Dates by typing the month number only

    One more question.
    Is there a place in VBA Editor where I can store this as inactive and then drop it into a sheet when I need it?

  12. #12
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Entering Dates by typing the month number only

    There are a few ways to disable the macro.

    One way
    Add a button on the worksheet with this code behind it - it toggles events ON and OFF
    Please Login or Register  to view this content.
    Note that this enables/disables ALL event macros

    Another way
    (I would elect for this)
    Add this as the first line of code in Private Sub Worksheet_Change
    Please Login or Register  to view this content.
    If OFF is entered in cell A1 (or your chosen cell) the macro exits without doing anything
    You could have a choice of OFF and ON in the cell (using a dropdown)

    Yet another way
    (a bit of a "back of fag-packet" solution!)
    Rename the macro with an X in front of the name
    so "Private Sub Worksheet_Change.." , become "XPrivate Sub Worksheet_Change..."
    and then it won't run

  13. #13
    Registered User
    Join Date
    01-05-2017
    Location
    carrer rockledge
    MS-Off Ver
    2013
    Posts
    5

    Re: Entering Dates by typing the month number only

    You must download Add-in A-Tools
    Note: Close all office application before installing
    Installation finish and open excel files. Any cells which is formated date can view as picture.

+ 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. Number of Days in each month between two dates
    By marshymell0 in forum Excel General
    Replies: 11
    Last Post: 06-15-2015, 01:28 AM
  2. Number of Month between two dates
    By suhabthan in forum Excel General
    Replies: 7
    Last Post: 03-04-2015, 12:59 PM
  3. [SOLVED] count the number of dates for last month and the number of dates for this month
    By JmundleBofA in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-25-2014, 08:37 PM
  4. [SOLVED] Convert number into Dates (End of Month)
    By acsishere in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-14-2013, 02:17 AM
  5. Counting number of unique dates per month in a list of duplicate dates
    By Rackle83 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-22-2013, 10:15 AM
  6. Replies: 2
    Last Post: 12-01-2012, 03:06 PM
  7. Count number of dates in one month
    By korygrandy in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-18-2008, 04:20 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