Refer to a different worksheet

B

Basta1980

Hi there,

I have this code

With ActiveSheet.QueryTables.Add(Connection:= _
"OLEDB;Provider=Microsoft.Office.List.OLEDB.1.0;",
Destination:=Range("A1"))

What I need is a code that doens not refer to the active sheet but to a
sheet with name TimeToImplement cell A1. How do I go about?!

Regards,

Basta1980
 
P

Patrick Molloy

if you mean the worksheet name is in A1 of the activesheet, then

With WorkSheets( Range("A1").Value ).QueryTables.Add(Connection:= _
"OLEDB;Provider=Microsoft.Office.List.OLEDB.1.0;", _
Destination:= .Range("A1"))
 
J

Jacob Skaria

With ActiveWorkbook.Sheets("TimeToImplement").QueryTables.Add(Connection:= _
"OLEDB;Provider=Microsoft.Office.List.OLEDB.1.0;",
Destination:=Range("A1"))

If this post helps click Yes
 
B

Basta1980

Patrick,

Thanks, but the problem was I didn't want to refer to an activesheet. But
this got me going in the right direction.

Thnx

Basta1980
 
B

Basta1980

Jakob,

Thanks. With a slight change (destination required sheetname) the code
worked perfect.

Regards

basta1980
 

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