View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Pam Pam is offline
external usenet poster
 
Posts: 128
Default make cell active in beginning of macro

Joel,
When I tried this it put the result in the cell I was in, although it seems
to be comparing the original cell?

"Joel" wrote:

Private Sub UserForm_Initialize()

If IsDate(Range("B1").Value) Then
Calendar1.Value = DateValue(Range("B1").Value)
Else
Calendar1.Value = Date

Range("B1").Value = Date

End If
End Sub

"Pam" wrote:

I am running the following code which works great for inserting a date into a
cell with a calendar, but it only works great if they are in the right active
cell when they click the macro. I need to reduce errors by making the active
cell b1 when they start the macro, do that it will check the date in that
cell, and return the date in that cell.
I'm lost., any help would be appreciated.
Thanks


Private Sub UserForm_Initialize()

If IsDate(ActiveCell.Value) Then
Calendar1.Value = DateValue(ActiveCell.Value)
Else
Calendar1.Value = Date

Range("B1").Value = Date

End If
End Sub