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: 132
Default Why does the date toggle between formats

I have the following code that updates a sheet on change to convert (fix)
dates to DMY. Occassionally the sheet will be updated again if the user
makes a second update (an infrequent event). On the second update the format
will change to MDY.

I tested this by repeatedly running the macro and can see the dates toggle
back and forth. Does anyone have any idea why or how I can fix it to DMY no
matter how many times it's activated?

Dim ColsToFix As Variant
Dim TypeOfCols As Variant
Dim iCol As Long

ColsToFix = Array("G", "E", "C", "K", "M", "Q", "R", "S", "U", "W")
TypeOfCols = Array(4, 1, 1, 1, 1, 1, 1, 1, 1, 1)

If UBound(TypeOfCols) < UBound(ColsToFix) Then
MsgBox "design error!-Cols & Types not matched"
Exit Sub
End If

With ActiveSheet
For iCol = LBound(ColsToFix) To UBound(ColsToFix)
.Cells(1, ColsToFix(iCol)).EntireColumn.TextToColumns _
DataType:=xlDelimited, _
FieldInfo:=Array(1, TypeOfCols(iCol))
Next iCol
End With
--
Jim
 
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 Formats david d Excel Discussion (Misc queries) 2 September 14th 08 12:29 PM
Dealing with date formats on expiration date bliten_bsas Excel Programming 1 October 4th 07 08:47 PM
Date Formats Amy Excel Discussion (Misc queries) 2 January 23rd 07 05:05 AM
date formats Matt Excel Discussion (Misc queries) 2 May 17th 06 07:52 AM
Date formats Hervinder Excel Discussion (Misc queries) 3 April 19th 06 01:22 PM


All times are GMT +1. The time now is 05:52 AM.

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"