For some reason, this macro can't import a single column text file. Can someone help me out with this?
Please Login or Register to view this content.
For some reason, this macro can't import a single column text file. Can someone help me out with this?
Please Login or Register to view this content.
Last edited by Bob1980; 12-21-2012 at 04:14 PM.
The syntax looks correct. What exactly happens?
You can step through each line of code (F8) in the VBA editor.
Does it error? If yes, what's the error?
Does the text file open?
Does it import anything?
What is the text in the text file
this code works, check the sheet name on this line
Set wsData = ActiveWorkbook.Sheets("AASTD Inj 1")
If solved remember to mark Thread as solved
Yeah, it's funny cause it works on all of my other txt data.
I get a Run-time error '9', Subscript out of range; on this line:
And then the macro creates a new spreadsheet book with the name of the txt file.Here's a sample of the data.Please Login or Register to view this content.
Last edited by Bob1980; 12-21-2012 at 04:36 PM.
The equal sign characters ("============") used as a section line separator within the text file is causing the error when you transfer the values to the sheet. Excel interprets a line that begins with an equal sign as a formula.
This will import the text directly to the sheet without having to transfer the values.
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks