Hi everyone,

I have a procedure which retrieves data from an Access database to Excel, which is working just fine.

However each time when I run the code to update the data in my sheet the named range assigned to the data array is updates with a sequence number.

This is an excerpt of the code:

vendor = "'ExampleData'"

With ActiveSheet.QueryTables.Add(Connection:=varConnection, Destination:=Range("A1"))
.CommandText = sqlstr
.Name = vendor
.Refresh BackgroundQuery:=False
End With


So the first time I run it the named range is called: "ExampleData"
The next time "ExampleData__1" followed by "ExampleData__2" etc.

How can I overwrite the old named range with a new one so the name remains the same?

Thanks!

Regards,

Michel