Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
End of Month Function in Visual Basic
I would like to initialize a text box in a user form with the last day of the
month calculated from the current date (Today) I tried the following: Private Sub UserForm_Initialize() Me.AcctPeriodInputBox.Value = EOMONTH(Date) End Sub How do I use Functions that are in Excel to calculate values in a macro? -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200701/1 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
End of Month Function in Visual Basic
Precede them by Application. or Application.WorksheetFunction.
Hth, Merjet |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
End of Month Function in Visual Basic
If you are using VBA anyway, there's no need for external functions:
Public Function LastDayOfMonth(WhichMonth As Date) As Date LastDayOfMonth = DateSerial(Year(WhichMonth), Month(WhichMonth) + 1, 0) End Function Adjust the argument/return value for your needs. NickHK "Fredriksson via OfficeKB.com" <u27002@uwe wrote in message news:6cc6f82b6e6b0@uwe... I would like to initialize a text box in a user form with the last day of the month calculated from the current date (Today) I tried the following: Private Sub UserForm_Initialize() Me.AcctPeriodInputBox.Value = EOMONTH(Date) End Sub How do I use Functions that are in Excel to calculate values in a macro? -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200701/1 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
End of Month Function in Visual Basic
Thank you for your suggestion
merjet wrote: Precede them by Application. or Application.WorksheetFunction. Hth, Merjet -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200701/1 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
End of Month Function in Visual Basic
Thank you for your suggestion
NickHK wrote: If you are using VBA anyway, there's no need for external functions: Public Function LastDayOfMonth(WhichMonth As Date) As Date LastDayOfMonth = DateSerial(Year(WhichMonth), Month(WhichMonth) + 1, 0) End Function Adjust the argument/return value for your needs. NickHK I would like to initialize a text box in a user form with the last day of the month calculated from the current date (Today) [quoted text clipped - 6 lines] How do I use Functions that are in Excel to calculate values in a macro? -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200701/1 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How should I do this (function or Visual basic) | Excel Worksheet Functions | |||
Call a Visual Basic Function with VLookup | Excel Worksheet Functions | |||
Can I run Visual Basic procedure using Excel Visual Basic editor? | Excel Programming | |||
Call XLA function in Visual Basic Macro ? | Excel Programming | |||
How do I use an array function in Visual basic .NET? | Excel Programming |