enter date in cell

vasu12

New Member
Joined
Feb 6, 2017
Messages
12
Sub date_for_month()

Dim startdate as date
Dim enddate as date

Startdate =#01 Feb 2017 #
Enddate =#01 Mar 3017#

Do while startdate < enddate
Activecell = startdate
Startdate = startdate + 1
Activecell.offset(0,1), range ("A1").select
Loop
End sub

Still need some fine tunes
1. Date enter in excel cell (I don't want to edit every time in program)
2.only one month will given as input, next month should take automatically.. ( I'm thinking as Date =[(year),(Month+1),(day) ] function
Will it work
3. How to make run another workbook macro from active(master ) workbook
 
Last edited:

Some videos you may like

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

snjpverma

Well-known Member
Joined
Oct 2, 2008
Messages
1,383
Office Version
  1. 2016
Platform
  1. Windows
Activecell.offset(0,1), range ("A1").select
Why is the highlighted text needed in the above code ? I think the offset will take it from the current cell to one column right. I just removed it and it worked fine.
Secondly, when you give the end date, the excel will automatically keep changing the months until it reaches the end date.
 

mole999

Moderator
Joined
Oct 23, 2004
Messages
10,516
Office Version
  1. 2019
  2. 2016
  3. 2013
Platform
  1. Windows
if its only every run in the month of need you could get that from the system clock, and have it identify the first of the month and the last day of the month
 

vasu12

New Member
Joined
Feb 6, 2017
Messages
12
Thanks for kind advice.
My problem is I don't want to edit every time in program to change date. Give me some idea to do in sheets cell itself. what I'm asking is entered in a cell and program should take that date and run..
 
Last edited:

vasu12

New Member
Joined
Feb 6, 2017
Messages
12

ADVERTISEMENT

Thanks for your kind advice.
No, I have to take print out before next month starts. So I can't use system clock
 

mole999

Moderator
Joined
Oct 23, 2004
Messages
10,516
Office Version
  1. 2019
  2. 2016
  3. 2013
Platform
  1. Windows
ok, so how about you have a sheet set aside for the start date you want and we build from that
 

vasu12

New Member
Joined
Feb 6, 2017
Messages
12
Thanks for your kind advice.
Separate sheet idea is good. But no other way to make this work
 

Watch MrExcel Video

Forum statistics

Threads
1,108,935
Messages
5,525,697
Members
409,660
Latest member
1817538628

This Week's Hot Topics

Top