![]() |
|
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Join Date: Apr 2003
Location: Latvia
Posts: 56
|
hi guys!
i would appreciate if anyone of you VBAmonsters could give me a sulution to a following problem. i need a program that would return the actual number of days of a month form randomly entered date (i.e. if 02/02/2004 is entered it should return 29). is the idea clear? hope you can help me & thanks in advance! hu |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Jul 2002
Posts: 39,281
|
Try this formula:
=DAY(DATE(YEAR(A1),MONTH(A1)+1,0)) where A1 contains your data. |
|
|
|
|
|
#3 |
|
MrExcel MVP
Join Date: May 2003
Posts: 8,474
|
Hi,
while wating for code, you could use this formula: =EOMONTH(A1,0)-EOMONTH(A1,-1)
__________________
"Fair Winds and Following Seas" |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: May 2002
Posts: 12,819
|
with a date in a1:
=DAY(DATE(YEAR(A1),MONTH(A1)+1,0)) |
|
|
|
|
|
#5 |
|
Join Date: Sep 2003
Posts: 994
|
Or :-
=DAY(EOMONTH(A1,0)) |
|
|
|
|
|
#6 |
|
Join Date: Apr 2003
Location: Latvia
Posts: 56
|
thanks!
that's ok, but i need a macro script (for generating a list of dates, which would contain only last dates of particular months). everything else except for the problem mentioned is taken care of, so do not bother about that. so... can you still hepl me? regards&thanks hu |
|
|
|
|
|
#7 |
|
Join Date: Sep 2003
Posts: 994
|
Where and how will the dates be created and where are the days per month to be put?
|
|
|
|
|
|
#8 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,208
|
Code:
Sub Tester() Dim dDate As Date '// Month/Day/Year dDate = #2/8/2003# MsgBox Format(DateSerial(Year(dDate), Month(dDate) + 1, 0), "dd") End Sub |
|
|
|
|
|
#9 |
|
Join Date: Apr 2003
Location: Latvia
Posts: 56
|
wow!
it seems that it works. thank you all very very very much! &respect hu |
|
|
|
|
|
#10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Spammer
Join Date: Jan 2004
Location: in the process of locating.
Posts: 372
|
I want to Repalce the year like if it is 2004 i want it to change it to 2005 and then to 2006 and so on plz tell me how to
******** ******************** ************************************************************************>
[HtmlMaker 2.42] To see the formula in the cells just click on the cells hyperlink or click the Name box PLEASE DO NOT QUOTE THIS TABLE IMAGE ON SAME PAGE! OTHEWISE, ERROR OF JavaScript OCCUR. in this sheet beacuse when i Replace with the Excel it gives some Error |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|