ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete the last Range Name (https://www.excelbanter.com/excel-programming/380350-delete-last-range-name.html)

DennisW

Delete the last Range Name
 
I import a text file into an excel template, and every import creates a name
for the imported data range. Is there a way to (1) prevent creating a Range
Name on import, (2) delete the Range Name at the end of the import macro, or
(3) delete the last Range Name from the .Names Collection?

I don't want to delete all names because I want to keep some of the
existing range names.

Tom Ogilvy

Delete the last Range Name
 
Is it a CSV file? If so, then just open it in Excel, then copy the data to
your template and close the original file without saving. (with code of
course).

Even if it isn't, you might still be able to use this approach using
OpenText

--
Regards,
Tom Ogilvy

"DennisW" wrote in message
...
I import a text file into an excel template, and every import creates a
name
for the imported data range. Is there a way to (1) prevent creating a
Range
Name on import, (2) delete the Range Name at the end of the import macro,
or
(3) delete the last Range Name from the .Names Collection?

I don't want to delete all names because I want to keep some of the
existing range names.




DennisW

Delete the last Range Name
 
The data is not a CSV file, but is a single column of data. Also, this
import is part of a macro which calls several macos to import additional data
and transform/manipulate the date once its in the template. I found that
this code works:
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Program Files\...\Estreslt.txt", Destination:=Range("A1"))
.Name = "Estreslt"


All times are GMT +1. The time now is 03:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com