LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default Date in userform being saved as general not date which affects sor

Try using the DateValue function, as in:

TextBox1.Value = Format(DateValue(MyDateReceived, "mmm-dd-yy")

VBA won't (I don't think) pass the formatting between variables, so I think
you might have to use the Format and DateValue combo each time you need the
date presented on the form.

--
Michael J. Malinsky
Pittsburgh, PA

"I am a bear of very little brain, and long
words bother me." -- AA Milne, Winnie the Pooh

"Cheryl" wrote in message
...
I have a date that was originally formatted custom mmm-dd-yy (Jan-02-96)on

the worksheet. When it is read into my form I have to convert it to this
format from ie 1/2/1996 which is how it seems to get stored when I write
back to the form. When I check the format.. on the worksheet it seems to be
stored as general. Visually, it appears the way I want it.. However... It
does not sort properly... It needs to sort this date the way I could with
conditional formatting on a worksheet.. When it date = today... It is
highlighted in red.. when it is greater than today.. it is highlighted in
green. This is so the users know what job is due today and future jobs... by
re-sorting or coloring differently...

The code loading the data is as follows.. (it is the reverse the saving)

Dim MyDateReceived, MyDateRequired, MyDateCompleted
Dim MyDesignStartDate, MyDesignExpectedCompletionDate,

MyDesignActualCompletionDate
Dim MyShopStartDate, MyShopExpectedCompletionDate,

MyShopActualCompletionDate
Dim Mystr1, Mystr2, Mystr3, Mystr4, Mystr5, Mystr6, Mystr7, Mystr8, Mystr9
Dim MyCustID, MystrCustID

txtID = Worksheets("Job Number List").Cells(lCurrentRow, 1).Value
txtJobNumber = Worksheets("Job Number List").Cells(lCurrentRow, 2).Value
txtAdjNo.Text = Worksheets("Job Number List").Cells(lCurrentRow, 3).Value
MyDateReceived = Worksheets("Job Number List").Cells(lCurrentRow, 4).Value
MyDateRequired = Worksheets("Job Number List").Cells(lCurrentRow, 5).Value
MyDateCompleted = Worksheets("Job Number List").Cells(lCurrentRow,

10).Value
MyDesignStartDate = Worksheets("Job Number List").Cells(lCurrentRow,

17).Value
MyDesignExpectedCompletionDate = Worksheets("Job Number

List").Cells(lCurrentRow, 19).Value
MyDesignActualCompletionDate = Worksheets("Job Number

List").Cells(lCurrentRow, 20).Value
MyShopStartDate = Worksheets("Job Number List").Cells(lCurrentRow,

22).Value
MyShopExpectedCompletionDate = Worksheets("Job Number

List").Cells(lCurrentRow, 23).Value
MyShopActualCompletionDate = Worksheets("Job Number

List").Cells(lCurrentRow, 24).Value

Mystr1 = (Format(MyDateReceived, "mmm-dd-yy"))
Mystr2 = (Format(MyDateRequired, "mmm-dd-yy"))
Mystr3 = (Format(MyDateCompleted, "mmm-dd-yy")

....


I am not sure where to look for a solution.. I will keep looking but hoped

perhaps someone can point me in the right direction.... since it looks like
when it sorts it sorts by the month, day, year.. rather than year, month,
day



 
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
Date open file with date saved Rita Excel Worksheet Functions 3 April 23rd 09 03:13 PM
general date to date format sherry Excel Discussion (Misc queries) 3 August 15th 08 04:21 AM
OFC 07 wrkbk saved short date format changes to general when reop Roberta Excel Discussion (Misc queries) 0 May 22nd 08 07:42 PM
how to convert julian date to general date arkprabha Excel Worksheet Functions 1 April 3rd 06 10:22 AM
How to change date as general "200306" to date "06/2003" Delwyn Excel Discussion (Misc queries) 1 June 15th 05 03:24 AM


All times are GMT +1. The time now is 07:43 AM.

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"