Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hey everyone I'm new to VB and need some help. I'm trying to input a file from a .dat file (output from Fortran code). The .dat file contains multiple column such as: --------- 2 5.48564954E+05 4.07889292E+06 5.47506020E+05 4.07922513E+06 3 5.48560812E+05 4.07880932E+06 5.47497497E+05 4.07914291E+06 4 5.48556669E+05 4.07872573E+06 5.47488975E+05 4.07906069E+06 5 5.48552526E+05 4.07864214E+06 5.47480453E+05 4.07897847E+06 6 5.48548383E+05 4.07855855E+06 5.47471931E+05 4.07889625E+06 7 5.48544240E+05 4.07847495E+06 5.47463408E+05 4.07881404E+06 8 5.48540097E+05 4.07839136E+06 5.47454886E+05 4.07873182E+06 9 5.48535954E+05 4.07830777E+06 5.47446364E+05 4.07864960E+06 10 5.48531811E+05 4.07822417E+06 5.47437842E+05 4.07856738E+06 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Turn on the macro Recorder
Tools=Macros=Record a Macro then open the file manually and go through the Text import wizard. turn off the macro recorder. You might have to rename the file to have a .txt extension to do it manually, but I think it will work without that. Now look at the recorded code. Alter to suit your needs. See help on the OpenText method. -- Regards, Tom Ogilvy "Nuc" wrote in message ... Hey everyone I'm new to VB and need some help. I'm trying to input a file from a .dat file (output from Fortran code). The .dat file contains multiple column such as: --------- 2 5.48564954E+05 4.07889292E+06 5.47506020E+05 4.07922513E+06 3 5.48560812E+05 4.07880932E+06 5.47497497E+05 4.07914291E+06 4 5.48556669E+05 4.07872573E+06 5.47488975E+05 4.07906069E+06 5 5.48552526E+05 4.07864214E+06 5.47480453E+05 4.07897847E+06 6 5.48548383E+05 4.07855855E+06 5.47471931E+05 4.07889625E+06 7 5.48544240E+05 4.07847495E+06 5.47463408E+05 4.07881404E+06 8 5.48540097E+05 4.07839136E+06 5.47454886E+05 4.07873182E+06 9 5.48535954E+05 4.07830777E+06 5.47446364E+05 4.07864960E+06 10 5.48531811E+05 4.07822417E+06 5.47437842E+05 4.07856738E+06 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() What about using an open statement such as: 'Open "file.dat" For Input As #1 'Open file for input to worksheet 'For i = 1 To ?? 'Line Input #1, commandline 'Worksheets("Sheet2").Cells(i, 1) = commandline I don't really know how to go from here.. This is only inputing the file into one column and I need two or more columns. Using the record macro like you said is ok but this would seem to work so that I can define the starting and stopping point at where I need to take the data. Such as taking lines 13 to 100 from the .dat file and importing them to the worksheet. Thanks, Nuc -- Nuc ------------------------------------------------------------------------ Nuc's Profile: http://www.excelforum.com/member.php...o&userid=28572 View this thread: http://www.excelforum.com/showthread...hreadid=482329 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
See Chip Pearson's site for sample code. Specify space as a delimiter:
http://www.cpearson.com/excel/imptext.htm import/export text files -- Regards, Tom Ogilvy "Nuc" wrote in message ... What about using an open statement such as: 'Open "file.dat" For Input As #1 'Open file for input to worksheet 'For i = 1 To ?? 'Line Input #1, commandline 'Worksheets("Sheet2").Cells(i, 1) = commandline I don't really know how to go from here.. This is only inputing the file into one column and I need two or more columns. Using the record macro like you said is ok but this would seem to work so that I can define the starting and stopping point at where I need to take the data. Such as taking lines 13 to 100 from the .dat file and importing them to the worksheet. Thanks, Nuc -- Nuc ------------------------------------------------------------------------ Nuc's Profile: http://www.excelforum.com/member.php...o&userid=28572 View this thread: http://www.excelforum.com/showthread...hreadid=482329 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thanks for the info I will try and get this going. Nuc -- Nuc ------------------------------------------------------------------------ Nuc's Profile: http://www.excelforum.com/member.php...o&userid=28572 View this thread: http://www.excelforum.com/showthread...hreadid=482329 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
data input format | Excel Discussion (Misc queries) | |||
Moving data in one excel column to another sheet based on user input | Excel Discussion (Misc queries) | |||
Input data format from GIS | Excel Discussion (Misc queries) | |||
How do I easily format a column to convert input of 120307 to 12:. | Excel Discussion (Misc queries) | |||
Saving a column of data in another file format | Excel Programming |