Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default Calendar Problem

Hi Everybody

I have added a calendar to a userform and used Ron DB's code to get it
working e.g

Private Sub Calendar1_Click()
ActiveCell.Value = CDbl(Calendar1.Value)

ActiveCell.NumberFormat = "dd/mm/yy"
ActiveCell.Select
End Sub

My problem is the date enters the ActiveCell OK (UK DATE) 01/07/07 no
problem and in a Listbox on viewing the row it reads as 01/07/07 however on
highlighting the Listbox Row in the TextBox assigned to the date it is the
serial number. Have tried Value - Text - formatting everyway but which all to
no avail. If I enter the date manually in the Cell and use Text as the format
in the Textbox everything is Ok. Any idea's to help solve this would be much
appreciated.
--
Many thanks

hazel
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Calendar Problem

Don't format the cell. Convert date to a string and write the string to the
cell

Private Sub Calendar1_Click()
ActiveCell.Value = Now()

ActiveCell = Format(ActiveCell, "dd/mm/yy")
ActiveCell.Select
End Sub

"Hazel" wrote:

Hi Everybody

I have added a calendar to a userform and used Ron DB's code to get it
working e.g

Private Sub Calendar1_Click()
ActiveCell.Value = CDbl(Calendar1.Value)

ActiveCell.NumberFormat = "dd/mm/yy"
ActiveCell.Select
End Sub

My problem is the date enters the ActiveCell OK (UK DATE) 01/07/07 no
problem and in a Listbox on viewing the row it reads as 01/07/07 however on
highlighting the Listbox Row in the TextBox assigned to the date it is the
serial number. Have tried Value - Text - formatting everyway but which all to
no avail. If I enter the date manually in the Cell and use Text as the format
in the Textbox everything is Ok. Any idea's to help solve this would be much
appreciated.
--
Many thanks

hazel

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default Calendar Problem

Hi Joel
Thanks that solved my problem -- changed the Now() to Calendar1 and it
worked fine -- can I just ask you another question ? I am entering dates from
the same calendar in to a couple of TextBoxes e.g.

Private Sub Add1_Click()
UserForm1.Tb1.Text = UserForm2.Calendar1.Value
End Sub

When I use it for the above at the same time it enters the date in of course
which ever Cell is active on the sheet is there any way of stopping this
happening or would another Calender be the answer?
--
Many thanks

hazel


"Joel" wrote:

Don't format the cell. Convert date to a string and write the string to the
cell

Private Sub Calendar1_Click()
ActiveCell.Value = Now()

ActiveCell = Format(ActiveCell, "dd/mm/yy")
ActiveCell.Select
End Sub

"Hazel" wrote:

Hi Everybody

I have added a calendar to a userform and used Ron DB's code to get it
working e.g

Private Sub Calendar1_Click()
ActiveCell.Value = CDbl(Calendar1.Value)

ActiveCell.NumberFormat = "dd/mm/yy"
ActiveCell.Select
End Sub

My problem is the date enters the ActiveCell OK (UK DATE) 01/07/07 no
problem and in a Listbox on viewing the row it reads as 01/07/07 however on
highlighting the Listbox Row in the TextBox assigned to the date it is the
serial number. Have tried Value - Text - formatting everyway but which all to
no avail. If I enter the date manually in the Cell and use Text as the format
in the Textbox everything is Ok. Any idea's to help solve this would be much
appreciated.
--
Many thanks

hazel

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Calendar Problem

There isn't enough info to answer your question. You could add an if
statement into the macro to add the date under certain conditions. The code
below is only a sample and not to be the real code.

Private Sub Add1_Click()
if (UserForm2.Calendar1.Value = 1) then
UserForm1.Tb1.Text = UserForm2.Calendar1.Value
end if
End Sub


"Hazel" wrote:

Hi Joel
Thanks that solved my problem -- changed the Now() to Calendar1 and it
worked fine -- can I just ask you another question ? I am entering dates from
the same calendar in to a couple of TextBoxes e.g.

Private Sub Add1_Click()
UserForm1.Tb1.Text = UserForm2.Calendar1.Value
End Sub

When I use it for the above at the same time it enters the date in of course
which ever Cell is active on the sheet is there any way of stopping this
happening or would another Calender be the answer?
--
Many thanks

hazel


"Joel" wrote:

Don't format the cell. Convert date to a string and write the string to the
cell

Private Sub Calendar1_Click()
ActiveCell.Value = Now()

ActiveCell = Format(ActiveCell, "dd/mm/yy")
ActiveCell.Select
End Sub

"Hazel" wrote:

Hi Everybody

I have added a calendar to a userform and used Ron DB's code to get it
working e.g

Private Sub Calendar1_Click()
ActiveCell.Value = CDbl(Calendar1.Value)

ActiveCell.NumberFormat = "dd/mm/yy"
ActiveCell.Select
End Sub

My problem is the date enters the ActiveCell OK (UK DATE) 01/07/07 no
problem and in a Listbox on viewing the row it reads as 01/07/07 however on
highlighting the Listbox Row in the TextBox assigned to the date it is the
serial number. Have tried Value - Text - formatting everyway but which all to
no avail. If I enter the date manually in the Cell and use Text as the format
in the Textbox everything is Ok. Any idea's to help solve this would be much
appreciated.
--
Many thanks

hazel

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default Calendar Problem

Hi Joel

thanks again for the help - I don't really know how much more info I can
give you? will probably have to use spinbuttons or another calendar for the
other textboxes its now getting a shade to complicated for me. All my lot in
this office want - is for me to try and make things as easy as possible for
them when they have to enter data in to the workbook.
--
Many thanks

hazel


"Joel" wrote:

There isn't enough info to answer your question. You could add an if
statement into the macro to add the date under certain conditions. The code
below is only a sample and not to be the real code.

Private Sub Add1_Click()
if (UserForm2.Calendar1.Value = 1) then
UserForm1.Tb1.Text = UserForm2.Calendar1.Value
end if
End Sub


"Hazel" wrote:

Hi Joel
Thanks that solved my problem -- changed the Now() to Calendar1 and it
worked fine -- can I just ask you another question ? I am entering dates from
the same calendar in to a couple of TextBoxes e.g.

Private Sub Add1_Click()
UserForm1.Tb1.Text = UserForm2.Calendar1.Value
End Sub

When I use it for the above at the same time it enters the date in of course
which ever Cell is active on the sheet is there any way of stopping this
happening or would another Calender be the answer?
--
Many thanks

hazel


"Joel" wrote:

Don't format the cell. Convert date to a string and write the string to the
cell

Private Sub Calendar1_Click()
ActiveCell.Value = Now()

ActiveCell = Format(ActiveCell, "dd/mm/yy")
ActiveCell.Select
End Sub

"Hazel" wrote:

Hi Everybody

I have added a calendar to a userform and used Ron DB's code to get it
working e.g

Private Sub Calendar1_Click()
ActiveCell.Value = CDbl(Calendar1.Value)

ActiveCell.NumberFormat = "dd/mm/yy"
ActiveCell.Select
End Sub

My problem is the date enters the ActiveCell OK (UK DATE) 01/07/07 no
problem and in a Listbox on viewing the row it reads as 01/07/07 however on
highlighting the Listbox Row in the TextBox assigned to the date it is the
serial number. Have tried Value - Text - formatting everyway but which all to
no avail. If I enter the date manually in the Cell and use Text as the format
in the Textbox everything is Ok. Any idea's to help solve this would be much
appreciated.
--
Many thanks

hazel

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calendar Control 12 printing problem Neal O Excel Programming 0 June 10th 07 01:07 AM
problem with calendar dates format s_ali_hassan[_9_] Excel Programming 6 June 30th 06 02:11 PM
Calendar problem with sheet protection? DORI Excel Programming 2 December 10th 05 04:46 AM
Calendar problem Patrick Simonds Excel Programming 9 September 12th 05 08:11 AM
Calendar Problem- What's Wrong? joe smith Excel Discussion (Misc queries) 6 March 22nd 05 10:36 PM


All times are GMT +1. The time now is 11:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"