#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 788
Default Application

I would like to create an application using MS Excel. Here is the tast at hand
I have a .csv file I need to import once that file is imported I need to
change one of the column so that the date would be mmddyy

Sample data of the .csv

Date 1 2 3 4
20051231 0.0446 0.0455 0.0461 0.0466
20051230 0.0445 0.0454 0.046 0.0465
20051229 0.0445 0.0453 0.0459 0.0465
20051228 0.0445 0.0453 0.0459 0.0464
20051227 0.0444 0.0453 0.0458 0.0464
20051226 0.0444 0.0453 0.0458 0.0464
20051225 0.0444 0.0453 0.0458 0.0464
20051224 0.0444 0.0453 0.0458 0.0464
20051223 0.0444 0.0453 0.0458 0.0464

Result I am looking to get

Date Term Rate
2005/12/31 1 4.46
2005/12/30 1 4.45
2005/12/29 1 4.45
2005/12/28 1 4.45
2005/12/27 1 4.44
2005/12/26 1 4.44
2005/12/25 1 4.44
2005/12/24 1 4.44
2005/12/23 1 4.44
2005/12/31 2 4.55
2005/12/30 2 4.54
2005/12/29 2 4.53
2005/12/28 2 4.53
2005/12/27 2 4.53
2005/12/26 2 4.53
2005/12/25 2 4.53
2005/12/24 2 4.53
2005/12/23 2 4.53
2005/12/31 3 4.61
2005/12/30 3 4.6
2005/12/29 3 4.59
2005/12/28 3 4.59
2005/12/27 3 4.58
2005/12/26 3 4.58
2005/12/25 3 4.58
2005/12/24 3 4.58
2005/12/23 3 4.58
2005/12/31 4 4.66
2005/12/30 4 4.65
2005/12/29 4 4.65
2005/12/28 4 4.64
2005/12/27 4 4.64
2005/12/26 4 4.64
2005/12/25 4 4.64
2005/12/24 4 4.64
2005/12/23 4 4.64


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Application

Chris,
Your example shows data of yyyy/mm/dd not mmddyy as stated
earlier; and you want to tranform columns into rows (and always/only 4
columns of data)?

"Chris" wrote:

I would like to create an application using MS Excel. Here is the tast at hand
I have a .csv file I need to import once that file is imported I need to
change one of the column so that the date would be mmddyy

Sample data of the .csv

Date 1 2 3 4
20051231 0.0446 0.0455 0.0461 0.0466
20051230 0.0445 0.0454 0.046 0.0465
20051229 0.0445 0.0453 0.0459 0.0465
20051228 0.0445 0.0453 0.0459 0.0464
20051227 0.0444 0.0453 0.0458 0.0464
20051226 0.0444 0.0453 0.0458 0.0464
20051225 0.0444 0.0453 0.0458 0.0464
20051224 0.0444 0.0453 0.0458 0.0464
20051223 0.0444 0.0453 0.0458 0.0464

Result I am looking to get

Date Term Rate
2005/12/31 1 4.46
2005/12/30 1 4.45
2005/12/29 1 4.45
2005/12/28 1 4.45
2005/12/27 1 4.44
2005/12/26 1 4.44
2005/12/25 1 4.44
2005/12/24 1 4.44
2005/12/23 1 4.44
2005/12/31 2 4.55
2005/12/30 2 4.54
2005/12/29 2 4.53
2005/12/28 2 4.53
2005/12/27 2 4.53
2005/12/26 2 4.53
2005/12/25 2 4.53
2005/12/24 2 4.53
2005/12/23 2 4.53
2005/12/31 3 4.61
2005/12/30 3 4.6
2005/12/29 3 4.59
2005/12/28 3 4.59
2005/12/27 3 4.58
2005/12/26 3 4.58
2005/12/25 3 4.58
2005/12/24 3 4.58
2005/12/23 3 4.58
2005/12/31 4 4.66
2005/12/30 4 4.65
2005/12/29 4 4.65
2005/12/28 4 4.64
2005/12/27 4 4.64
2005/12/26 4 4.64
2005/12/25 4 4.64
2005/12/24 4 4.64
2005/12/23 4 4.64


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default Application

Sub LoadTextFile()
Dim myTextFile As String

'change path and name to suit your app
myTextFile = "C:\Path\FileName.txt"


Workbooks.OpenText Filename:= _
myTextFile, Origin:=xlWindows, _
StartRow:=1, DataType:=xlDelimited, ConsecutiveDelimiter:=True _
, Space:=True, FieldInfo:=Array(Array(1, 5), Array(2, 1), Array _
(3, 1), Array(4, 1), Array(5, 1)), TrailingMinusNumbers:=True
Columns("A:A").NumberFormat = "yyyy/mm/dd;@"
End Sub

--
Cheers
Nigel



"Chris" wrote in message
...
I would like to create an application using MS Excel. Here is the tast at
hand
I have a .csv file I need to import once that file is imported I need to
change one of the column so that the date would be mmddyy

Sample data of the .csv

Date 1 2 3 4
20051231 0.0446 0.0455 0.0461 0.0466
20051230 0.0445 0.0454 0.046 0.0465
20051229 0.0445 0.0453 0.0459 0.0465
20051228 0.0445 0.0453 0.0459 0.0464
20051227 0.0444 0.0453 0.0458 0.0464
20051226 0.0444 0.0453 0.0458 0.0464
20051225 0.0444 0.0453 0.0458 0.0464
20051224 0.0444 0.0453 0.0458 0.0464
20051223 0.0444 0.0453 0.0458 0.0464

Result I am looking to get

Date Term Rate
2005/12/31 1 4.46
2005/12/30 1 4.45
2005/12/29 1 4.45
2005/12/28 1 4.45
2005/12/27 1 4.44
2005/12/26 1 4.44
2005/12/25 1 4.44
2005/12/24 1 4.44
2005/12/23 1 4.44
2005/12/31 2 4.55
2005/12/30 2 4.54
2005/12/29 2 4.53
2005/12/28 2 4.53
2005/12/27 2 4.53
2005/12/26 2 4.53
2005/12/25 2 4.53
2005/12/24 2 4.53
2005/12/23 2 4.53
2005/12/31 3 4.61
2005/12/30 3 4.6
2005/12/29 3 4.59
2005/12/28 3 4.59
2005/12/27 3 4.58
2005/12/26 3 4.58
2005/12/25 3 4.58
2005/12/24 3 4.58
2005/12/23 3 4.58
2005/12/31 4 4.66
2005/12/30 4 4.65
2005/12/29 4 4.65
2005/12/28 4 4.64
2005/12/27 4 4.64
2005/12/26 4 4.64
2005/12/25 4 4.64
2005/12/24 4 4.64
2005/12/23 4 4.64




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
difference application.quit & application.close Pierre via OfficeKB.com[_2_] Excel Programming 4 November 8th 05 07:55 PM
Application.GetOpenFilename vs Application.Dialogs(xlDialogsOpen) Paul Martin Excel Programming 5 August 5th 05 04:44 PM
Replace application.RTD property by Application.RTDServers collect John.Greenan Excel Programming 1 July 7th 05 02:05 PM
macro to close excel application other than application.quit mary Excel Programming 1 September 14th 04 03:43 PM
application.quit will not shut off application john Excel Programming 0 January 9th 04 11:29 PM


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