Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 23rd, 2009, 06:58 PM
Registered User
 
Join Date: Aug 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Multiple txt file input to excel in 1 row per file

Hi Excel Gurus!

I am new to Excel Macro and I am just wondering if you can help me with my problem. I have multiple txt files with the same format and tab delimited. I would like to run an excel macro that can convert my txt files to excel row by row for each txt file.

The excel columns should look like:
date time lot number operator serial nominal_values cx cy xh yx measured_values cx cy xh yx and so on...

The Input txt file looks like:

Date: 2009-07-10
Time: 14:19
Lot Number: 2
Operator ID: 48013275
Serial Number: H09F040104

Name nominal Values measured Values St.Dev. lower Limit upper Limit limit St.Dev.
cx 1240.0000 1232.9380 4.1540 1170.0000 1293.0000 50.0000
cy 1240.0000 1232.6350 4.0350 1170.0000 1293.0000 50.0000
xh 512.0000 497.3666 1.1670 470.0000 532.0000 5.0000
yh 256.0000 268.4369 0.6813 236.0000 286.0000 5.0000

Dist. 3.5000 3.4642 0.0000 3.3500 3.6500 0.0750
Res. Pixel/[°] 22.5000 22.3614 0.0000 22.1000 22.9000 0.0500

Pitch 0.0000 0.3140 0.0330 -1.0000 1.0000 0.1000
Yaw 0.0000 -0.4760 0.0560 -1.0000 1.0000 0.1000
Roll 0.0000 0.0860 0.0030 -1.0000 1.0000 0.1000

End of data
Reply With Quote
  #2 (permalink)  
Old August 23rd, 2009, 11:35 PM
Registered User
 
Join Date: Aug 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello!



Thank you for the responses.



To simplify the requirement, I made sample input txt files below and the sample output format in excel.



Input txt file #1



11 AAA

22 BBB

33 CCC



00 77 88 99

44 DDD GGG JJJ

55 EEE HHH KKK

66 FFF III LLL





Input txt file #2



11 MMM

22 NNN

33 OOO



00 77 88 99

44 PPP SSS VVV

55 QQQ TTT WWW

66 RRR UUU XXX



The output excel file format should look like this:



AAA BBB CCC DDD EEE FFF GGG HHH III JJJ KKK LLL

MMM NNN OOO PPP QQQ RRR SSS TTT UUU VVV WWW XXX



Assumptions:

- the input files are tab delimited

- same format for all input txt file

- 1 row per txt file in excel output



Please help.
Reply With Quote
  #3 (permalink)  
Old August 24th, 2009, 01:17 AM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

There are many ways to read a text file

http://vbadud.blogspot.com/2007/06/v...h-leading.html

The above URL should help you

Once you read the information line by line then you can remove the numeric characters by using IsNumeric

Please start with the intial coding and we will be always glad to take you through

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
Reply With Quote
  #4 (permalink)  
Old August 24th, 2009, 02:11 PM
Registered User
 
Join Date: Jul 2009
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I recommend you to use GemBox Excel component for .NET. Here is a list of reasons why it's better to use it then regular Excel Automation/Interop.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
import excel file and stop at first empty row derik SQL Server DTS 2 September 24th, 2004 04:16 AM
reading a row of characters from an input file Omega_st1 C++ Programming 4 October 28th, 2003 01:35 AM
Multiple file input single file output.... jdm_mboy Biztalk 1 July 2nd, 2003 03:35 AM



All times are GMT -4. The time now is 11:16 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.