Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I recorded a macro that imports data into a sheet. I am finding that
each time I run this macro, a new named range is added to the list of named ranges. Does anyone know why this is happening, and how I can stop this action? This does not create a problem per se; it's just that the list of names gets longer and longer. Each new named range is for the same range, since I always import to the same sheet/range. Each time the macro is run, the name has a number at the end of the name that is incremented, e.g., receipt_20, receipt_21, etc. The recorded VBA looks like this: With ActiveSheet.QueryTables.Add(Connection:= _ "TEXT;K:\usrfiles\download\receipt.txt", Destination:=Range("recpts!A2")) .Name = "receipt" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .TextFilePromptOnRefresh = False .TextFilePlatform = 437 .TextFileStartRow = 3 .TextFileParseType = xlFixedWidth .TextFileTextQualifier = xlTextQualifierDoubleQuote .TextFileConsecutiveDelimiter = False .TextFileTabDelimiter = True .TextFileSemicolonDelimiter = False .TextFileCommaDelimiter = False .TextFileSpaceDelimiter = False .TextFileColumnDataTypes = Array(9, 2, 2, 3, 1, 1) .TextFileFixedColumnWidths = Array(2, 1, 2, 10, 13) .TextFileTrailingMinusNumbers = True .Refresh BackgroundQuery:=False End With I tried commenting out the line with .Name in front, but it still created a new named range. Thanks, Carroll Rinehart |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Named Range DTS Import of Excel Data | Excel Discussion (Misc queries) | |||
Formatting time from imported data | Excel Discussion (Misc queries) | |||
Named Range changes when data is imported | Excel Discussion (Misc queries) | |||
Macro run each time a new workbook created | Excel Discussion (Misc queries) | |||
Outlook wants an Excel named range to import contact data why? | Excel Discussion (Misc queries) |