Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to open folder and let you chose file, then continue import
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to open folder and let you chose file, then continue import
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(xlcell typeblanks).entirerow.delete on error goto 0 rascal wrote: 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. -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to open folder and let you chose file, then continue import
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 "rascal" wrote in message ... 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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to open most current file in folder | Excel Discussion (Misc queries) | |||
Macro syntax to open file in current explorer folder | Excel Discussion (Misc queries) | |||
Macro syntax to open file in current explorer folder | Excel Programming | |||
using macro to open every file in a folder | Excel Programming | |||
using macro to open every file in a folder | Excel Programming |