enfantter
01-30-2008, 01:08 AM
Hey all,
I'm trying to generate a list of dates. All dates between two dates should be displayed. The two dates are entered in a userform.
The code from the userform looks like this:
Private Sub upfbtn_Click()
Dim start As Date
Dim slut As Date
slut = sluttxt.Value
start = starttxt.Value
diff = Val(slut) - Val(start)
With Worksheets("Data")
lastrow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = 1 To diff + 1
.Cells(lastrow + i, "A").Value = "Jack"
.Cells(lastrow + i, "B").Value = start + i - 1
Next i
End With
indferie.Hide
End Sub
But it doesnt work - any sugs?!
I'm trying to generate a list of dates. All dates between two dates should be displayed. The two dates are entered in a userform.
The code from the userform looks like this:
Private Sub upfbtn_Click()
Dim start As Date
Dim slut As Date
slut = sluttxt.Value
start = starttxt.Value
diff = Val(slut) - Val(start)
With Worksheets("Data")
lastrow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = 1 To diff + 1
.Cells(lastrow + i, "A").Value = "Jack"
.Cells(lastrow + i, "B").Value = start + i - 1
Next i
End With
indferie.Hide
End Sub
But it doesnt work - any sugs?!