Delete the last Range Name

G

Guest

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.
 
T

Tom Ogilvy

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
 
G

Guest

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"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top