![]() |
![]() |
|
|||||||
| 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 |
|
Board Regular
Join Date: Apr 2002
Location: Sarasota, FL
Posts: 1,539
|
In my first cell I have a date, say
1/1/2001 In the next cell I want the date at the end of the month(I can't use EOmonth): 1/31/2001 VBA has the DateAdd function which is perfect but I can't use it in the spreadsheet. Help! |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
=DATE(YEAR(A1),MONTH(A1)+1,0) |
|
|
|
|
|
#3 | |
|
Board Regular
Join Date: Apr 2002
Posts: 112
|
Quote:
|
|
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Mar 2002
Posts: 363
|
Try this:
=DATE(YEAR(A1),MONTH(A1)+1,DAY(A1))-1
__________________
It's never too late to learn something new. Ricky |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Apr 2002
Location: Sarasota, FL
Posts: 1,539
|
Yes!!
=Date(year(A1),Month(A1)+1),Day(A1))-1 worked perfect, Thanks for the replies!! By the way, I couldn't use EoMonth because I send this spreadsheet all over the state and if the analysis toolkit wasn't available on someone's system, it would be a big pain. |
|
|
|
|
|
#6 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
Quote:
Given 2/2/2001 in A1 the above formula computes 3/1/2001 while =EOMONTH(A1,0) and =DATE(YEAR(A1),MONTH(A1)+1,0) both computes: 2/28/2001 Aladin |
|
|
|
|
|
|
#7 |
|
Board Regular
Join Date: Apr 2002
Location: Sarasota, FL
Posts: 1,539
|
Fortunately, I usually start with the first day of the month, but not always. So if anyone knows a way to use EOmonth(which is what I want) without having the Analysis Toolkit installed, that would be great.
|
|
|
|
|
|
#8 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
Quote:
=DATE(YEAR(A1),MONTH(A1)+1,0) |
|
|
|
|
|
|
#9 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
Or you could do the recipient a favor and install it for them (it comes w/ Excel):
Code:
Private Sub auto_open()
If AddIns("Analysis toolpak").Installed = False _
Then AddIns("Analysis toolpak").Installed = True
End Sub
|
|
|
|
|
|
#10 |
|
Board Regular
Join Date: Apr 2002
Location: Sarasota, FL
Posts: 1,539
|
Not that I intended for this question to get so involved but I would like to have the recipients auto_open the Analysis Toolkit, unfortunately the code:
Private Sub auto_open() If AddIns("Analysis toolpak").Installed = False _ Then AddIns("Analysis toolpak").Installed = True End Sub gives me a Run-Time 1004 error, Unable to set the installed property of the add-in class. I can do pretty well with the initial equation provided above, I'm just digging now. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|