Problem with using dates entered via UserForm

B

Brian C

I'm trying to create a date range in Excel in a column on
a worksheet 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 cell A2 and a cell called
A1Enddate respectively on the AutumnHT1 workshet).

I execute the following code when they hit the FINISH
button on the userform:

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

The macro works if I enter dates directly into the cells
and then run it rather than using a userform.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top