PDA

View Full Version : Solved: Using the EOMonth Function



mferrisi
04-09-2007, 09:35 AM
I get an error when I attempt to use the EOMonth Function. I've pasted both the creation of the array and the attempt to extract a value and use the function. Thank you for your help.



For ACounter = 2 To DataCount
MultiArr(ACounter, 2) = Format(Cells(ACounter, 2).Value, "mm/dd/yyyy")
Next ACounter

Dim TestDate As Date
Dim SecondDate As Date
Dim abc As Integer

For abc = 2 To DataCount
If MultiArr(abc, 1) = "ThisOne" Then
TestDate = MultiArr(abc, 2)
SecondDate = WorksheetFunction.EOMonth(TestDate)
Else
End If
Next abc


Edited 10-Apr-07 by geekgirlau. Reason: insert vba tags

mdmackillop
04-09-2007, 09:46 AM
Do you have Analysis ToolPak loaded?

Bob Phillips
04-09-2007, 09:48 AM
EOMONTH is not a worksheet function exposed to VBA.



For ACounter = 2 To DataCount
MultiArr(ACounter, 2) = Format(Cells(ACounter, 2).Value, "mm/dd/yyyy")
Next ACounter

Dim testDate As Date
Dim SecondDate As Date
Dim abc As Integer

For abc = 2 To DataCount
If MultiArr(abc, 1) = "ThisOne" Then
testDate = MultiArr(abc, 2)
SecondDate = DateSerial(Year(testDate), Month(testDate) + 1, 0)
Else
End If
Next abc