chuggins143
Board Regular
- Joined
- Nov 10, 2009
- Messages
- 100
I have a macro that copies data from a text file and pastes the data into a sheet... issue is that every time it runs, it generates a new named range... how do I get Excel to stop doing this? I'm sure it's a setting in the code, but I'm just not seeing it... Here's the code I have that works... The resulting named range is "Raw_1", where the number increments with each run... I see where the Raw part is coming from, but why is it generating the named range in the first place?
Anyone see what I'm missing??
Thanks!
Chad
VBA Code:
Sheets("Data1").Select 'Opens the test text file and pastes the data into the DataTarget sheet
With ActiveSheet.QueryTables.Add(Connection:="TEXT;C:\NI\UL_Excel_Data1.txt", _
Destination:=Range("C" & Range("_Run1").Row + Range("_Run1").Value))
.Name = "Raw"
.FieldNames = False
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
Anyone see what I'm missing??
Thanks!
Chad