Hi guys
How to find start date of the month from the last Date of the month using vba. e.g we have 30.01.2012 (This date given). How can I know from this when the month started.
Thanks
Hi
You can also do it, using formula.
Why do you need VBA, for this?
Regards
Fotis.
I am proud that i am Greek.
Just to know every one.We Greeks, we are nοt proud of our politicians. Υou?
Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.
Please,mark your thread [SOLVED] if you received your answer.
My Avadar picture, is from Athens Acropolis.
http://www.theacropolismuseum.gr
http://www.visitgreece.gr/
Which formula can I use?
Thanks
I think that, generally speaking, the month starts on the first day of the month ... day 1. What am I missing?
Sub GetFirstDay() Dim LastDay As Date Dim FirstDay As Date LastDay = DateValue("31/01/12") MsgBox Day(LastDay) FirstDay = DateValue("1/" & Month(LastDay) & "/" & Year(LastDay)) MsgBox Day(FirstDay) End Sub
Regards, TMS
..Sorry for the delay..
First day of the month(your date in A1)>> =DATE(YEAR(A1);MONTH(A1); 1)
First Workday of the month>> =WORKDAY(DATE(YEAR(A1);MONTH(A1);1)-1;1;Holidays)
Change the semi-colons, to gomma, if it is necassary.
Hope to helps you.
Regards
Fotis.
I am proud that i am Greek.
Just to know every one.We Greeks, we are nοt proud of our politicians. Υou?
Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.
Please,mark your thread [SOLVED] if you received your answer.
My Avadar picture, is from Athens Acropolis.
http://www.theacropolismuseum.gr
http://www.visitgreece.gr/
Hi TMShucks
sorry I'm intruding, that I wonder if it were using a cell instead of the line of code ..
, how would the code?MsgBox Day (lastday)
@marreco: You should be opening a new thread and referring back to this one (see below).
However:
MsgBox Day(Range("A1"))
For future reference ...
Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
Sorry, thank you for help
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks