+ Reply to Thread
Results 1 to 18 of 18

find march in 3/15/2017

  1. #1
    Registered User
    Join Date
    07-25-2017
    Location
    Oiho
    MS-Off Ver
    2010 standard
    Posts
    90

    find march in 3/15/2017

    I have excel workbooks that have dates in this format (3/15/2017).
    I want to be able to have my program to look at the cell and compare just the month part of date with the month I enter.
    Thanks
    James

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: find march in 3/15/2017

    If the date is in A1... and you enter Jan (or whatever..) in B1, this will return TRUE if the months match, otherwise it'll return FALSE. So exactly, what do you want it to do when there is/isn't a match??

    =MONTH(A1)=MONTH(1&B1)
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Registered User
    Join Date
    07-25-2017
    Location
    Oiho
    MS-Off Ver
    2010 standard
    Posts
    90

    Re: find march in 3/15/2017

    I have a user form that has 12 command buttons each with a month on it. if I click the march button it will open the workbook and look at the date (3/15/2017) i want it look at the month part of the date and see if it matches the month of the command button. if it matches I have code that will do some copy and pasting.

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: find march in 3/15/2017

    So... can my formula do what you want? without seeing ANYTHING it's hard to tell...

  5. #5
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: find march in 3/15/2017

    Please post a sample workbook.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  6. #6
    Registered User
    Join Date
    07-25-2017
    Location
    Oiho
    MS-Off Ver
    2010 standard
    Posts
    90

    Re: find march in 3/15/2017

    Thank you mehmetcik for the info as I am still new to the forum and am still learning

  7. #7
    Registered User
    Join Date
    07-25-2017
    Location
    Oiho
    MS-Off Ver
    2010 standard
    Posts
    90

    Re: find march in 3/15/2017

    glenn,
    Thanks for your help. I need vba code. yours looks like a formula that I would enter into a cell??

  8. #8
    Registered User
    Join Date
    07-25-2017
    Location
    Oiho
    MS-Off Ver
    2010 standard
    Posts
    90

    Re: find march in 3/15/2017

    mehmetcik,
    how do i post the workbook?

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: find march in 3/15/2017

    Yea. i hadn't notice this was in the vba forum (I'm useless with vba).

    However...

    do post a sheet, for the benefit of others..

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

  10. #10
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: find march in 3/15/2017

    To place the date in the cell:

    Please Login or Register  to view this content.
    To read the date from a cell:

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    07-25-2017
    Location
    Oiho
    MS-Off Ver
    2010 standard
    Posts
    90

    Re: find march in 3/15/2017

    hope this helps
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    07-25-2017
    Location
    Oiho
    MS-Off Ver
    2010 standard
    Posts
    90

    Re: find march in 3/15/2017

    maybe something like...

    If DatePart("m") = 3 Then

    rest of my code here.

  13. #13
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: find march in 3/15/2017

    You, probably, want the month name judging by the title of this thread:

    Dim N as string

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  14. #14
    Registered User
    Join Date
    07-25-2017
    Location
    Oiho
    MS-Off Ver
    2010 standard
    Posts
    90

    Re: find march in 3/15/2017

    xladept,
    Thanks for the help.
    i think what im needing to do is LEN( the date and just look at the month part.

  15. #15
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: find march in 3/15/2017

    Well the month part is represented by either the first character or the first two characters

    I think my code is less bother than:

    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    07-25-2017
    Location
    Oiho
    MS-Off Ver
    2010 standard
    Posts
    90

    Re: find march in 3/15/2017

    I'm sorry everyone.
    I always have issues explaining what i'm trying to do.
    my program will open a workbook and look at sheet 1 cell b17. (3/15/2017)all dates will be different.
    If the month in this case is 3 matches the month of the button I click... then my code will do what i want. if they don't match, it will go to the next workbook.

  17. #17
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: find march in 3/15/2017

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  18. #18
    Registered User
    Join Date
    07-25-2017
    Location
    Oiho
    MS-Off Ver
    2010 standard
    Posts
    90

    Re: find march in 3/15/2017

    I solved it with this...
    Dim iMonth As Integer
    iMonth = Month(CDate([B17].Value))
    If iMonth = 3 Then
    Sheets(2).Range("A16:D31").Select
    Sheets(2).Range("A16:D31").Copy

+ 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: 23
    Last Post: 01-03-2022, 10:45 AM
  2. Call in the Cavalry - 2017
    By JBeaucaire in forum The Water Cooler
    Replies: 166
    Last Post: 01-03-2018, 12:58 PM
  3. Planner to start from Jan 2017
    By Shamz41 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-14-2017, 04:32 AM
  4. Replies: 10
    Last Post: 05-13-2017, 01:58 AM
  5. [SOLVED] How to format dates like 9/25/2017 to 09/25/2017
    By chessmonsta in forum Excel General
    Replies: 11
    Last Post: 03-17-2017, 03:11 AM
  6. To all and Excel-lent 2017
    By Keebellah in forum Excel General
    Replies: 1
    Last Post: 01-01-2017, 06:09 AM
  7. [SOLVED] March 2005 Actual Info vs March 2006 Plan Info
    By Al in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-18-2005, 03:06 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