Set DTPicker Date Value if it is not Visible on Userform

R

RyanH

I have a DTPicker that has its Visible Property set to False at design time.
When I try to set the value in my Worksheet Double Click Event VBA throws an
error, why?
ERROR: Run-Time Error '35788'. An error occured in a cell to the Windows
Date and Time Picker control. But when I set the Visible Property to True it
works, why?

Option Explicit

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)

' only assign a date value to DTPicker if there is a date in the cell,
' so todays date will show by default
If Not IsEmpty(Cells(Target.Row, "M")) Then
ERROR>> .dtpScheduledShipDate = Cells(Target.Row, "M")
End If
If Not IsEmpty(Cells(Target.Row, "N")) Then
ERROR>> .dtpActualShipDate = Cells(Target.Row, "N")
End If

' show userform
frmSalesSummary.Show
End Sub
 
R

RyanH

I wish it was that easy. I can't find any help on why you can't set a
DTPickers value if its Visible Property = False.
 
M

Mike

Im sorry for last post maybe this would work

dtpScheduledShipDate.Visible = True
dtpScheduledShipDate = Cells(Target.Row, "M")
dtpScheduledShipDate.Visible = false
 
R

RyanH

Thanks for the Reply. I have a way around it. I want to know why the
Visible Property matters when setting the DTPickers value?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top