Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I just wanted to say that you guys RULE, a million thank you's to whoever created, and/or manages this site. KEEP UP THE GOOD WORK..."

Geography

Where in the world do Tek-Tips members come from?

VBScript Needed to Manipulate Excel Sheet

MikeRI10 (TechnicalUser)
2 May 12 13:12
VBScript masters, I need your help.  I am not very good at scripting, and what I need is probably very easy for someone here to figure out.  Here is what I need the script to do:

1:  Open Excel and import a TXT file using delimited text import.  Here is the "tuff" part.  Certain columns need to be formatted as "text only" BEFORE the data is imported.  Otherwise leading 0's will be truncated.  If it is easier to write the script to make all cells "text" only prior to the import, that's perfectly fine too.

2:  Once the data is imported to Excel, the script needs to scan the "A" column starting at A2.  If there is data in a cell (anything but blank/empty), then I need the current date to populate in the respective cell in column "O" (ex:  A2 has "12345", then cell O2 needs todays date (5/2/2012) populated.  Once a blank cell in column "A" is found, stop and save the file as TXT.  The first "blank" cell in column "A" will be the EOF.

I hope this makes sense, and I want to thank everyone in advance for tackling this.

Any questions or if anyone needs clarification, please ask.

Thank You!

 
SkipVought (Programmer)
2 May 12 13:20


hi,

Is there a reason that you are coding this in VBS, EXTERNAL to the Excel Workbook, rather than using VBA, INTERNAL to the Excel workbook?  The IMPORT can do EXACTLY what you want.

Quote:

Certain columns need to be formatted as "text only" BEFORE the data is imported.
This can be done in the IMPORT process.

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

PHV (MIS)
2 May 12 13:25
Anyway, what have you tried so far and where in your code are you stuck ?

Hope This Helps, PH.
FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?

MikeRI10 (TechnicalUser)
2 May 12 13:47
SkipVought,

Our client uses a BAT (yes, BAT file) file which performs an Export from a DCT (Data Connectivity Tool).  It is a simple unattended export which creates the TXT file that needs to be manipulated.  If possible, I would simply like to add to the BAT file "scripting" that will kick off this manipulation.  Basically, I would like to have one file that the client can launch to perform all steps needed and automate this process.  Export to a TXT, open in Excel and add date to column, then import back into the DCT solution.

The BAT file currently does the Export/Import.  I just need to "insert" additional language/scripting that would perform this manipulation seemlessly.  

I am open to any and all suggestions to make this easy.

Thank you again!

 

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close