worksheet function vs macro

T

Thai.NLNguyen

Hello,

I am new to Excel VBA. At my work we need to validate many .txt files
before we upload these .txt files for further processing. Within each
..txt files one 1 line of text contains comma separated values about 1
client. Some columns in this line of comma separated values need to be
validated. In short I would like to have column validation for each row
of data in the .txt file.

I would like to know how to attack this issue the best way. Do I write
a macro with all the necessary code to validate these .txt file entries
(after importing into Excel). So that each time I need to validate a
..txt file I open up the template containing the macro and do a "Run"
macro command. Or do I make use of worksheet functions and build in the
conditional statements that checks for each line (after importing into
Excel)?

Later, I would also like to know if you can generate some sort of error
messaging feature. Like some columns are required data cells and cannot
be omitted. Somehow I would like to have compiled all those error
messages into a new sheet, and once you click on of the error messages
in the new sheet, it it will take you the original sheet to the excact
entry that needs to be corrected. This little project starting to smell
more like a macro.

This sounds to be a big mouthful and some advice for you gurus out
there is very much appreciated.

Thai
 
H

Harlan Grove

(e-mail address removed) wrote...
....
I would like to know how to attack this issue the best way. . . .
....

Don't use Excel.

What you describe is simple text file processing. There are much better
tools for this than Excel, using either functions or macros within
Excel. If you're running Windows 98SE, Me, 2000 or XP or Internet
Explorer 5.0 or later, then you have Windows Script Host installed on
your PC. The validation task you describe would require no more than
20-30 lines of VBScript code. If you're running Windows NT4, 2000 or
XP, then you could even do this using batch files. That includes
prompting the user to enter/correct invalid fields and writing the
corrections to replacement text files.
 
T

Thai.NLNguyen

Harlan,

Thank you for the tips and insight. I will look at the options and give
it a go.

Thai
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top