Hi there, thanks for looking.
The code below takes two dates, and works out the dates between them & pasted them in the destination Column A.
My dates are variable. I have my code below correctly pasting the ranges into column A ( working in another sub routine ). I need to use this again with a different destination. When I offset the destination to column L I have an error occur - I am stumped on how to do this. I have reverted this code to its format in which it was working.
your help is much appreciated
Sub PasteDates()
Dim StartDate As Date
Dim EndDate As Date
Dim NumberOfDays As Integer
Worksheets("MOA WORK FILE").Activate
StartDate = Workbooks("Copy of MOA_MASTER_FILE").Worksheets("DATERANGE").Range("A1")
EndDate = Workbooks("Copy of MOA_MASTER_FILE").Worksheets("DATA STRIP").Range("G4")
Range("A1").Value = StartDate
Range("A1").Select
NumberOfDays = DateDiff("d", StartDate, EndDate)
NumberOfDays = NumberOfDays + 1
Selection.AutoFill Destination:=Range("A1:A" & NumberOfDays), Type:=xlFillDefault
End Sub
Bookmarks