![]() |
Problem Creating a Date Range
I'm trying to create a date range in Excel. I use a userform to enter
start and end date, using control source for the userform fields to pu the dates in a worksheet in A2 and a cell called A1Enddate. I then execute the following code: Sub Macro3() ' ' Macro3 Macro ' Macro recorded 15/04/2004 by blcutler ' Sheets("AutumnHT1").Select Range("A2").Select Selection.DataSeries Rowcol:=xlColumns, Type:=xlChronological Date:= _ xlWeekday, Step:=1, Stop:=Range("A1Enddate"), Trend:=False End Sub I get the following error: Run time error 1004 DataSeries method of range class failed Any ideas of what may be happening? There is defintely data put in th cells (A2 and A1Enddate) on AutumnHT1 by the userform. The Userfor executes on a different sheet hence the Sheets("AutumnHT1").Selec -- Message posted from http://www.ExcelForum.com |
Problem Creating a Date Range
Your code works OK for me.
The only thing I suspect is a possible a mis-spelling o Stop:=Range("A1Enddate"). Also, this is a bit lazy, and might be better fully qualified as :- Stop:=ActiveSheet.Range("A1Enddate").Valu -- Message posted from http://www.ExcelForum.com |
Problem Creating a Date Range
See one more reply at your other post.
"coolroaming <" wrote: I'm trying to create a date range in Excel. I use a userform to enter a start and end date, using control source for the userform fields to put the dates in a worksheet in A2 and a cell called A1Enddate. I then execute the following code: Sub Macro3() ' ' Macro3 Macro ' Macro recorded 15/04/2004 by blcutler ' Sheets("AutumnHT1").Select Range("A2").Select Selection.DataSeries Rowcol:=xlColumns, Type:=xlChronological, Date:= _ xlWeekday, Step:=1, Stop:=Range("A1Enddate"), Trend:=False End Sub I get the following error: Run time error 1004 DataSeries method of range class failed Any ideas of what may be happening? There is defintely data put in the cells (A2 and A1Enddate) on AutumnHT1 by the userform. The Userform executes on a different sheet hence the Sheets("AutumnHT1").Select --- Message posted from http://www.ExcelForum.com/ -- Dave Peterson |
All times are GMT +1. The time now is 06:30 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com