View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default date update in VBA

if txtDate and txtDue are checkboxes and txtDue has the enabled property set
to false when the userform is shown. then you want to click one the area of
the disabled checkbox and have it come to life and take on the value of the
checkbox txtDate, then you can use this:

Private Sub UserForm_MouseDown(ByVal Button _
As Integer, ByVal Shift As Integer, _
ByVal X As Single, ByVal Y As Single)
With txtDue
If Y = .Top And Y <= .Top + .Height Then
If X = .Left And X <= .Left + .Width Then
.Enabled = True
.Value = txtDate.Value
End If
Else
End If
End With

End Sub

--
Regards,
Tom Ogilvy



"L Scholes" wrote:

Carim's method works, but it only enables txtDue when I click
txtDate. I actually want txtDue to stay disabled until I click it, I
just want it's value to change to the value in txtDate when I enable
it. (I dont always use a Due Date, but if I do it is generally the next
day or two, so it is easier to start from the Date.)(If that is clearer
than mud.)

I don't know how to follow mrice's advice. I tried to set the
value in txtDue to "txtDate" and get an error message. (???)

I appreciate your help.