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

I am in USA. The macro is being used in South Africa. Dates in SA are
written ddmmyy. 12/02/08 is Feb. 12, 08 and not Dec 2, 08. I am having a
problem with the way Excel is formating the date.

This is the code I am using:
The date is 12/02/08 (Feb 02, 08)

1) Example
With ActiveCell.Offset(0, 0)
.NumberFormat = "ddmmyy"
.Value = RunDate(MyNum)
.HorizontalAlignment = xlCenter
End With

1) When you look at the worksheet cell (A19) the date appears as 021208 in
the cell. Click on the cell, at the formula windows it shows 12/2/2008. I
need the cell (A19) to show 120208. Because of this it sorts incorrectly and
places the values in the incorrect location. It sorts based on Dec 2 08.

2) Example
With ActiveCell.Offset(0, 0)
.Value = Format(RunDate(MyNum), "ddmmyy")
.HorizontalAlignment = xlCenter
End With

It now sorts correct. But I think only because the value 21208 is small than
130208.
But when you look at the worksheet cell (A2) the value appears as 21208 in
the cell. Click on the cell, at the formula windows it shows 21208. I need
the cell (A2) to show 120208. And the program needs to think it is Feb 12 08.

The worksheet that the data is printed to is created when the macro runs.

Thanks for your help.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Formatting date

On Sun, 23 Mar 2008 03:10:01 -0700, Nils Titley
wrote:

I am in USA. The macro is being used in South Africa. Dates in SA are
written ddmmyy. 12/02/08 is Feb. 12, 08 and not Dec 2, 08. I am having a
problem with the way Excel is formating the date.

This is the code I am using:
The date is 12/02/08 (Feb 02, 08)

1) Example
With ActiveCell.Offset(0, 0)
.NumberFormat = "ddmmyy"
.Value = RunDate(MyNum)
.HorizontalAlignment = xlCenter
End With

1) When you look at the worksheet cell (A19) the date appears as 021208 in
the cell. Click on the cell, at the formula windows it shows 12/2/2008. I
need the cell (A19) to show 120208. Because of this it sorts incorrectly and
places the values in the incorrect location. It sorts based on Dec 2 08.

2) Example
With ActiveCell.Offset(0, 0)
.Value = Format(RunDate(MyNum), "ddmmyy")
.HorizontalAlignment = xlCenter
End With

It now sorts correct. But I think only because the value 21208 is small than
130208.
But when you look at the worksheet cell (A2) the value appears as 21208 in
the cell. Click on the cell, at the formula windows it shows 21208. I need
the cell (A2) to show 120208. And the program needs to think it is Feb 12 08.

The worksheet that the data is printed to is created when the macro runs.

Thanks for your help.



See discussion in your other thread.
--ron
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Formatting date

Where does MyNum come from?

Formatting the cell in an umambiguous date format may make debugging easier:

..numberformat = "mmmm dd, yyyy"

You have at least two active threads for this question. Which one should be
used?



Nils Titley wrote:

I am in USA. The macro is being used in South Africa. Dates in SA are
written ddmmyy. 12/02/08 is Feb. 12, 08 and not Dec 2, 08. I am having a
problem with the way Excel is formating the date.

This is the code I am using:
The date is 12/02/08 (Feb 02, 08)

1) Example
With ActiveCell.Offset(0, 0)
.NumberFormat = "ddmmyy"
.Value = RunDate(MyNum)
.HorizontalAlignment = xlCenter
End With

1) When you look at the worksheet cell (A19) the date appears as 021208 in
the cell. Click on the cell, at the formula windows it shows 12/2/2008. I
need the cell (A19) to show 120208. Because of this it sorts incorrectly and
places the values in the incorrect location. It sorts based on Dec 2 08.

2) Example
With ActiveCell.Offset(0, 0)
.Value = Format(RunDate(MyNum), "ddmmyy")
.HorizontalAlignment = xlCenter
End With

It now sorts correct. But I think only because the value 21208 is small than
130208.
But when you look at the worksheet cell (A2) the value appears as 21208 in
the cell. Click on the cell, at the formula windows it shows 21208. I need
the cell (A2) to show 120208. And the program needs to think it is Feb 12 08.

The worksheet that the data is printed to is created when the macro runs.

Thanks for your help.


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default Formatting date

Dave,

I suppose the other one. As you can see I am not having much luck with this
problem.

"Dave Peterson" wrote:

Where does MyNum come from?

Formatting the cell in an umambiguous date format may make debugging easier:

..numberformat = "mmmm dd, yyyy"

You have at least two active threads for this question. Which one should be
used?



Nils Titley wrote:

I am in USA. The macro is being used in South Africa. Dates in SA are
written ddmmyy. 12/02/08 is Feb. 12, 08 and not Dec 2, 08. I am having a
problem with the way Excel is formating the date.

This is the code I am using:
The date is 12/02/08 (Feb 02, 08)

1) Example
With ActiveCell.Offset(0, 0)
.NumberFormat = "ddmmyy"
.Value = RunDate(MyNum)
.HorizontalAlignment = xlCenter
End With

1) When you look at the worksheet cell (A19) the date appears as 021208 in
the cell. Click on the cell, at the formula windows it shows 12/2/2008. I
need the cell (A19) to show 120208. Because of this it sorts incorrectly and
places the values in the incorrect location. It sorts based on Dec 2 08.

2) Example
With ActiveCell.Offset(0, 0)
.Value = Format(RunDate(MyNum), "ddmmyy")
.HorizontalAlignment = xlCenter
End With

It now sorts correct. But I think only because the value 21208 is small than
130208.
But when you look at the worksheet cell (A2) the value appears as 21208 in
the cell. Click on the cell, at the formula windows it shows 21208. I need
the cell (A2) to show 120208. And the program needs to think it is Feb 12 08.

The worksheet that the data is printed to is created when the macro runs.

Thanks for your help.


--

Dave Peterson

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
conditional formatting for cell date to equal today's date Sistereinstein Excel Worksheet Functions 2 September 10th 12 07:53 PM
Date Formatting MichaelR Excel Discussion (Misc queries) 4 June 23rd 08 03:34 PM
Date formatting Melissa Excel Discussion (Misc queries) 2 November 9th 06 05:37 PM
Date formatting Liesl Excel Discussion (Misc queries) 1 March 28th 06 06:56 AM
Date Colum Date Formatting & Validation Mike[_81_] Excel Programming 1 June 7th 04 01:59 AM


All times are GMT +1. The time now is 07:25 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"