Macro to open folder and let you chose file, then continue import

G

Guest

Hi:
I am trying to create a macro that when run will open a particular folder,
let you select the text file, than import it. I have gotten the marco done
that opens the folder, however once I choose the file I am not sure how to
proceed. Right now I do it manually, when I import it I use the text import
wizard and chose "Fixed width", start the import at line 9, move the lines so
that they are in the proper place, then import it into excel. Once in excel
I remove all the empty rows, which is every other row. Can I accomplish all
this with either 1 or 2 macros. If so, any ideas on how?
Thanks a lot for any help.
 
D

Dave Peterson

Record a macro when you open that text file manually. You'll see all the
details that you need for parsing your data.

And maybe you can sort your range so all the empty cells go to the bottom?

or...

Can you pick out a column that always has data in it if that row is used? I
used column X for my sample code:

On error resume next
activesheet.range("x:x").cells.specialcells(xlcelltypeblanks).entirerow.delete
 
T

Tim

Start by recording a macro while you open the text file: edit that so it
will accept a filepath selected by the user using
Application.GetOpenFilename().

Tim
 

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