PC Review


Reply
Thread Tools Rate Thread

Calendar to insert dates in a form

 
 
=?Utf-8?B?U3RlZW4=?=
Guest
Posts: n/a
 
      25th Nov 2006
Hi

Im pretty new in VBA but have managed to create the Calender following the
information given in http://www.fontstuff.com/vba/vbatut07.htm. Now i wood
like to use this for inserting dates in a form (Start Date and EndDate). I
have created the form and made all the code and is seems to work. I am using
to txt fields for entering the start og end dates. I woold like the Calendar
to be the only tool used for entrering dates (no manual date written) - how
can I do this task?

/Stony
 
Reply With Quote
 
 
 
 
Ron de Bruin
Guest
Posts: n/a
 
      25th Nov 2006
Hi Steen

Userform or Sheet ?

See this page
http://www.rondebruin.nl/calendar.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steen" <(E-Mail Removed)> wrote in message news:3A595944-8B79-4D28-ADB5-(E-Mail Removed)...
> Hi
>
> Im pretty new in VBA but have managed to create the Calender following the
> information given in http://www.fontstuff.com/vba/vbatut07.htm. Now i wood
> like to use this for inserting dates in a form (Start Date and EndDate). I
> have created the form and made all the code and is seems to work. I am using
> to txt fields for entering the start og end dates. I woold like the Calendar
> to be the only tool used for entrering dates (no manual date written) - how
> can I do this task?
>
> /Stony

 
Reply With Quote
 
=?Utf-8?B?U3RlZW4=?=
Guest
Posts: n/a
 
      25th Nov 2006
Useform

"Ron de Bruin" wrote:

> Hi Steen
>
> Userform or Sheet ?
>
> See this page
> http://www.rondebruin.nl/calendar.htm
>
> --
> Regards Ron de Bruin
> http://www.rondebruin.nl
>
>
> "Steen" <(E-Mail Removed)> wrote in message news:3A595944-8B79-4D28-ADB5-(E-Mail Removed)...
> > Hi
> >
> > Im pretty new in VBA but have managed to create the Calender following the
> > information given in http://www.fontstuff.com/vba/vbatut07.htm. Now i wood
> > like to use this for inserting dates in a form (Start Date and EndDate). I
> > have created the form and made all the code and is seems to work. I am using
> > to txt fields for entering the start og end dates. I woold like the Calendar
> > to be the only tool used for entrering dates (no manual date written) - how
> > can I do this task?
> >
> > /Stony

>

 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      25th Nov 2006
Hi Steen

Try this basic example

Add two userforms to the workbook
One with only the calendar named Userform1

Add this code event

Private Sub Calendar1_Click()
UserForm2.ActiveControl.Value = Me.Calendar1.Value
Unload Me
End Sub

And one with the name Userform2 with this code

Private Sub TextBox1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
UserForm1.Show
End Sub

Private Sub TextBox2_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
UserForm1.Show
End Sub


Run the userform named Userform2 to test



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steen" <(E-Mail Removed)> wrote in message news:803B8D47-6463-4277-8123-(E-Mail Removed)...
> Useform
>
> "Ron de Bruin" wrote:
>
>> Hi Steen
>>
>> Userform or Sheet ?
>>
>> See this page
>> http://www.rondebruin.nl/calendar.htm
>>
>> --
>> Regards Ron de Bruin
>> http://www.rondebruin.nl
>>
>>
>> "Steen" <(E-Mail Removed)> wrote in message news:3A595944-8B79-4D28-ADB5-(E-Mail Removed)...
>> > Hi
>> >
>> > Im pretty new in VBA but have managed to create the Calender following the
>> > information given in http://www.fontstuff.com/vba/vbatut07.htm. Now i wood
>> > like to use this for inserting dates in a form (Start Date and EndDate). I
>> > have created the form and made all the code and is seems to work. I am using
>> > to txt fields for entering the start og end dates. I woold like the Calendar
>> > to be the only tool used for entrering dates (no manual date written) - how
>> > can I do this task?
>> >
>> > /Stony

>>

 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      25th Nov 2006
Add one line in the click event

Private Sub Calendar1_Click()
UserForm2.ActiveControl.Value = Me.Calendar1.Value
UserForm2.ActiveControl.SetFocus
Unload Me
End Sub


Good night



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ron de Bruin" <(E-Mail Removed)> wrote in message news:%(E-Mail Removed)...
> Hi Steen
>
> Try this basic example
>
> Add two userforms to the workbook
> One with only the calendar named Userform1
>
> Add this code event
>
> Private Sub Calendar1_Click()
> UserForm2.ActiveControl.Value = Me.Calendar1.Value
> Unload Me
> End Sub
>
> And one with the name Userform2 with this code
>
> Private Sub TextBox1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
> UserForm1.Show
> End Sub
>
> Private Sub TextBox2_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
> UserForm1.Show
> End Sub
>
>
> Run the userform named Userform2 to test
>
>
>
> --
> Regards Ron de Bruin
> http://www.rondebruin.nl
>
>
> "Steen" <(E-Mail Removed)> wrote in message news:803B8D47-6463-4277-8123-(E-Mail Removed)...
>> Useform
>>
>> "Ron de Bruin" wrote:
>>
>>> Hi Steen
>>>
>>> Userform or Sheet ?
>>>
>>> See this page
>>> http://www.rondebruin.nl/calendar.htm
>>>
>>> --
>>> Regards Ron de Bruin
>>> http://www.rondebruin.nl
>>>
>>>
>>> "Steen" <(E-Mail Removed)> wrote in message news:3A595944-8B79-4D28-ADB5-(E-Mail Removed)...
>>> > Hi
>>> >
>>> > Im pretty new in VBA but have managed to create the Calender following the
>>> > information given in http://www.fontstuff.com/vba/vbatut07.htm. Now i wood
>>> > like to use this for inserting dates in a form (Start Date and EndDate). I
>>> > have created the form and made all the code and is seems to work. I am using
>>> > to txt fields for entering the start og end dates. I woold like the Calendar
>>> > to be the only tool used for entrering dates (no manual date written) - how
>>> > can I do this task?
>>> >
>>> > /Stony
>>>

 
Reply With Quote
 
=?Utf-8?B?U3RlZW4=?=
Guest
Posts: n/a
 
      26th Nov 2006
Hi Ron

Hope you had a good sleep you deserve it :-)

You are the best - works great.

Two questions:
1. Can the format be changed - it displays dates in the format "mm/dd/yyyy"
and I would like it to be "yyyy.mm.dd"
2. I am using the dates to filter a list of dates and with the format used
by the Calendar (mm/dd/yyyy) everything works :-), but with the other date
format there seems to be a problem (yyyy.mm.dd). The filter (custom) is setup
right but the filter dosn't work right before I activate i manualy once more
- can you help on that?

-------------------------------------------
If ErrorHandling Then
...
Else
Dim sStart, sEnd As String
sStart = txtStartDate.Value
sEnd = txtEndDate.Value
Selection.AutoFilter Field:=3, Criteria1:=">=" & sStart,
Operator:=xlAnd, Criteria2:="<=" & sEnd
End If
--------------------

"Ron de Bruin" wrote:

> Add one line in the click event
>
> Private Sub Calendar1_Click()
> UserForm2.ActiveControl.Value = Me.Calendar1.Value
> UserForm2.ActiveControl.SetFocus
> Unload Me
> End Sub
>
>
> Good night
>
>
>
> --
> Regards Ron de Bruin
> http://www.rondebruin.nl
>
>
> "Ron de Bruin" <(E-Mail Removed)> wrote in message news:%(E-Mail Removed)...
> > Hi Steen
> >
> > Try this basic example
> >
> > Add two userforms to the workbook
> > One with only the calendar named Userform1
> >
> > Add this code event
> >
> > Private Sub Calendar1_Click()
> > UserForm2.ActiveControl.Value = Me.Calendar1.Value
> > Unload Me
> > End Sub
> >
> > And one with the name Userform2 with this code
> >
> > Private Sub TextBox1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
> > UserForm1.Show
> > End Sub
> >
> > Private Sub TextBox2_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
> > UserForm1.Show
> > End Sub
> >
> >
> > Run the userform named Userform2 to test
> >
> >
> >
> > --
> > Regards Ron de Bruin
> > http://www.rondebruin.nl
> >
> >
> > "Steen" <(E-Mail Removed)> wrote in message news:803B8D47-6463-4277-8123-(E-Mail Removed)...
> >> Useform
> >>
> >> "Ron de Bruin" wrote:
> >>
> >>> Hi Steen
> >>>
> >>> Userform or Sheet ?
> >>>
> >>> See this page
> >>> http://www.rondebruin.nl/calendar.htm
> >>>
> >>> --
> >>> Regards Ron de Bruin
> >>> http://www.rondebruin.nl
> >>>
> >>>
> >>> "Steen" <(E-Mail Removed)> wrote in message news:3A595944-8B79-4D28-ADB5-(E-Mail Removed)...
> >>> > Hi
> >>> >
> >>> > Im pretty new in VBA but have managed to create the Calender following the
> >>> > information given in http://www.fontstuff.com/vba/vbatut07.htm. Now i wood
> >>> > like to use this for inserting dates in a form (Start Date and EndDate). I
> >>> > have created the form and made all the code and is seems to work. I am using
> >>> > to txt fields for entering the start og end dates. I woold like the Calendar
> >>> > to be the only tool used for entrering dates (no manual date written) - how
> >>> > can I do this task?
> >>> >
> >>> > /Stony
> >>>

>

 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      26th Nov 2006
Hi Steen

You can use the format function for the display

UserForm2.ActiveControl.Value = Format(Me.Calendar1.Value, "yyyy.mm.dd")


Use Dateserial if you want to filter on dates with code
I like to use 3 comboboxes if you want to filter on dates (See EasyFilter)
and use the combobox names in the DateSerial

rng.AutoFilter Field:=4, Criteria1:=">=" & DateSerial(1947, 2, 23), _
Operator:=xlOr, Criteria2:="<=" & DateSerial(1988, 5, 7) ' yyyy-mm-dd format

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steen" <(E-Mail Removed)> wrote in message news:872345C5-6663-4987-81D5-(E-Mail Removed)...
> Hi Ron
>
> Hope you had a good sleep you deserve it :-)
>
> You are the best - works great.
>
> Two questions:
> 1. Can the format be changed - it displays dates in the format "mm/dd/yyyy"
> and I would like it to be "yyyy.mm.dd"
> 2. I am using the dates to filter a list of dates and with the format used
> by the Calendar (mm/dd/yyyy) everything works :-), but with the other date
> format there seems to be a problem (yyyy.mm.dd). The filter (custom) is setup
> right but the filter dosn't work right before I activate i manualy once more
> - can you help on that?
>
> -------------------------------------------
> If ErrorHandling Then
> ...
> Else
> Dim sStart, sEnd As String
> sStart = txtStartDate.Value
> sEnd = txtEndDate.Value
> Selection.AutoFilter Field:=3, Criteria1:=">=" & sStart,
> Operator:=xlAnd, Criteria2:="<=" & sEnd
> End If
> --------------------
>
> "Ron de Bruin" wrote:
>
>> Add one line in the click event
>>
>> Private Sub Calendar1_Click()
>> UserForm2.ActiveControl.Value = Me.Calendar1.Value
>> UserForm2.ActiveControl.SetFocus
>> Unload Me
>> End Sub
>>
>>
>> Good night
>>
>>
>>
>> --
>> Regards Ron de Bruin
>> http://www.rondebruin.nl
>>
>>
>> "Ron de Bruin" <(E-Mail Removed)> wrote in message news:%(E-Mail Removed)...
>> > Hi Steen
>> >
>> > Try this basic example
>> >
>> > Add two userforms to the workbook
>> > One with only the calendar named Userform1
>> >
>> > Add this code event
>> >
>> > Private Sub Calendar1_Click()
>> > UserForm2.ActiveControl.Value = Me.Calendar1.Value
>> > Unload Me
>> > End Sub
>> >
>> > And one with the name Userform2 with this code
>> >
>> > Private Sub TextBox1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
>> > UserForm1.Show
>> > End Sub
>> >
>> > Private Sub TextBox2_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
>> > UserForm1.Show
>> > End Sub
>> >
>> >
>> > Run the userform named Userform2 to test
>> >
>> >
>> >
>> > --
>> > Regards Ron de Bruin
>> > http://www.rondebruin.nl
>> >
>> >
>> > "Steen" <(E-Mail Removed)> wrote in message news:803B8D47-6463-4277-8123-(E-Mail Removed)...
>> >> Useform
>> >>
>> >> "Ron de Bruin" wrote:
>> >>
>> >>> Hi Steen
>> >>>
>> >>> Userform or Sheet ?
>> >>>
>> >>> See this page
>> >>> http://www.rondebruin.nl/calendar.htm
>> >>>
>> >>> --
>> >>> Regards Ron de Bruin
>> >>> http://www.rondebruin.nl
>> >>>
>> >>>
>> >>> "Steen" <(E-Mail Removed)> wrote in message news:3A595944-8B79-4D28-ADB5-(E-Mail Removed)...
>> >>> > Hi
>> >>> >
>> >>> > Im pretty new in VBA but have managed to create the Calender following the
>> >>> > information given in http://www.fontstuff.com/vba/vbatut07.htm. Now i wood
>> >>> > like to use this for inserting dates in a form (Start Date and EndDate). I
>> >>> > have created the form and made all the code and is seems to work. I am using
>> >>> > to txt fields for entering the start og end dates. I woold like the Calendar
>> >>> > to be the only tool used for entrering dates (no manual date written) - how
>> >>> > can I do this task?
>> >>> >
>> >>> > /Stony
>> >>>

>>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Use Calendar to insert dates in a form Steen Microsoft Excel Programming 2 22nd Dec 2008 03:13 PM
Re: pull down calendar to insert dates & times Gord Dibben Microsoft Excel Misc 1 10th Jan 2007 01:32 AM
How to insert a calendar to choose dates- =?Utf-8?B?Sm9lTWE=?= Microsoft Excel Misc 2 7th Apr 2006 04:55 PM
Adding Dates to a Calendar from a Form =?Utf-8?B?Q2FwdF9Sb24=?= Microsoft Outlook Form Programming 0 28th Nov 2005 01:27 PM
Add custom form dates to calendar danieldunn10 Microsoft Outlook Form Programming 0 22nd Oct 2005 01:54 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:36 PM.