last day of mounth
On Thu, 18 Sep 2003 22:48:16 +0300, "GUS" wrote:
I want to put the last days of a given number of months at cells(a,1)
The first month must be the next month from (system day)
if user input is 10 then
cell(1,1).value=lastday of October
cell(2,1).value=lastday of November
etc.
With VBA of course
Well, something as simple as:
==================
Sub MonthEnd()
Dim ui As String
ui = InputBox("Input Month Number: ")
On Error GoTo handler
Cells(1, 1).Value = DateSerial(Year(Now), ui + 1, 0)
Cells(2, 1).Value = DateSerial(Year(Now), ui + 2, 0)
handler: Exit Sub 'or do whatever
End Sub
=================
will work. But you probably want to restrict the range of valid entries; and
you may want to do something to decide whether to use this year or next year.
--ron
|