View Single Post
  #4   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

Thank you, I knew it was simple

"N10" wrote:

Pam


Private Sub UserForm_Initialize()

Range("b1").select

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

Range("B1").Value = Date

End If


Best N10

End Sub
"Pam" wrote in message
...
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