View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
alexandraVBAgirl alexandraVBAgirl is offline
external usenet poster
 
Posts: 12
Default VBA Help needed -- compile error: object required

This code always gives me the error above. I have no idea what's wrong with
this
The point is to go through a list of dates and if they are less than say
1/1/2005 (my start date entered in the spreadsheet) change them to 0 and
keep others as is. But this doesn't seem to work at all. Could anyone pls
help me? Thanks

Sub click()

Dim counter As Integer
Dim curCell As Date
Dim startDate As Date
Dim endDate As Date


Range("e1").Value = startDate

For counter = 1 To 20
Set curCell = Worksheets("sheet1").Cells(counter, 3)
If curCell.Value < startDate.Value Then curCell.Value = 0
Next counter
End If

End Sub