Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
kiwicolin
 
Posts: n/a
Default Seemingly changing date format?


Hi I have a sheet that I update using a form with the code below. The
problem I am having is that it seems to randomly change the date format
on the sheet from dd/mm/yyyy to mm/dd/yyyy. It seems to be totally
random. I have checked the cell formats and they seem to be all set to
dd/mm/yyyy. I have checked the system settings and they seem good too.
I can enter a couple of dates correctly then it will fail on me, if I
ignore it & continue it will suddenly do a few more dates as I wish and
then fail again. The dates on the form looks ok each time though.

Any suggestions out there.

I would really appreciatte any help.


Thanks.


Colin

Private Sub CommandButton8_Click()
If txtdate.Value = "" Then Exit Sub
If txttrain.Value = "" Then Exit Sub
ActiveSheet.Unprotect Password:="********"

Range("A14").Select
Do

If IsEmpty(ActiveCell) = False Then ActiveCell.Offset(1, 0).Select

Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = txttrain.Value
ActiveCell.Offset(0, 1) = txtdate.Value
ActiveCell.Offset(0, 2) = txtresult.Value
ActiveCell.Offset(0, 3) = txtrefresh.Value
ActiveCell.Offset(0, 4) = txttrainer.Value



ActiveSheet.Protect Password:="********"
ActiveWorkbook.Save

Unload Me

frmdataentry.Show
End Sub


--
kiwicolin
------------------------------------------------------------------------
kiwicolin's Profile: http://www.excelforum.com/member.php...o&userid=19861
View this thread: http://www.excelforum.com/showthread...hreadid=473116

  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

The value in txtdate is a string.

When you plop it into the worksheet excel takes over. It does what it wants.
If it sees it as a date, xl will treat it as a date. If xl doesn't see a date,
then it'll be treated as a string.

You might want to remove any ambiguity (and make validation a bit easier) by
using a calendar control on your userform.

Ron de Bruin has some tips/links at:
http://www.rondebruin.nl/calendar.htm

kiwicolin wrote:

Hi I have a sheet that I update using a form with the code below. The
problem I am having is that it seems to randomly change the date format
on the sheet from dd/mm/yyyy to mm/dd/yyyy. It seems to be totally
random. I have checked the cell formats and they seem to be all set to
dd/mm/yyyy. I have checked the system settings and they seem good too.
I can enter a couple of dates correctly then it will fail on me, if I
ignore it & continue it will suddenly do a few more dates as I wish and
then fail again. The dates on the form looks ok each time though.

Any suggestions out there.

I would really appreciatte any help.

Thanks.

Colin

Private Sub CommandButton8_Click()
If txtdate.Value = "" Then Exit Sub
If txttrain.Value = "" Then Exit Sub
ActiveSheet.Unprotect Password:="********"

Range("A14").Select
Do

If IsEmpty(ActiveCell) = False Then ActiveCell.Offset(1, 0).Select

Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = txttrain.Value
ActiveCell.Offset(0, 1) = txtdate.Value
ActiveCell.Offset(0, 2) = txtresult.Value
ActiveCell.Offset(0, 3) = txtrefresh.Value
ActiveCell.Offset(0, 4) = txttrainer.Value

ActiveSheet.Protect Password:="********"
ActiveWorkbook.Save

Unload Me

frmdataentry.Show
End Sub

--
kiwicolin
------------------------------------------------------------------------
kiwicolin's Profile: http://www.excelforum.com/member.php...o&userid=19861
View this thread: http://www.excelforum.com/showthread...hreadid=473116


--

Dave Peterson
  #3   Report Post  
kiwicolin
 
Posts: n/a
Default


Thanks for the suggestion Dave.

As I am using 2003 I guess I could use monthview instead. It's
certainly worth a go.


Cheers for that.


Colin


--
kiwicolin
------------------------------------------------------------------------
kiwicolin's Profile: http://www.excelforum.com/member.php...o&userid=19861
View this thread: http://www.excelforum.com/showthread...hreadid=473116

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
format date in excel Nigel Excel Discussion (Misc queries) 2 September 15th 05 09:52 PM
Excel keeps converting text to date format John T via OfficeKB.com Excel Discussion (Misc queries) 4 September 12th 05 06:48 PM
Why Does Date Format Change on Chart John Taylor Excel Discussion (Misc queries) 0 September 11th 05 08:16 AM
Imported Date & Time format with calcs. managed in excel from imrp Todd F. Excel Worksheet Functions 0 July 8th 05 09:03 PM
Format Cells - Date options Ben Rum Excel Discussion (Misc queries) 1 May 25th 05 05:53 PM


All times are GMT +1. The time now is 05:43 PM.

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

About Us

"It's about Microsoft Excel"