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
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
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
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.
So... can my formula do what you want? without seeing ANYTHING it's hard to tell...
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.
Thank you mehmetcik for the info as I am still new to the forum and am still learning
glenn,
Thanks for your help. I need vba code. yours looks like a formula that I would enter into a cell??
mehmetcik,
how do i post the workbook?
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.
To place the date in the cell:
To read the date from a cell:![]()
Please Login or Register to view this content.
![]()
Please Login or Register to view this content.
hope this helps
maybe something like...
If DatePart("m") = 3 Then
rest of my code here.
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
xladept,
Thanks for the help.
i think what im needing to do is LEN( the date and just look at the month part.
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.
![]()
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.
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.
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
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks