Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
GUS GUS is offline
external usenet poster
 
Posts: 45
Default last day of mounth

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
a sum from one sheet and to put in an invoice for each mounth thomasg New Users to Excel 1 September 27th 05 01:49 AM


All times are GMT +1. The time now is 10:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"