range problem with code

jek40

Active Member
Joined
Jan 17, 2005
Messages
317
I have a button on sheet2 and would like to copy the table from this website and paste it on sheet1. how could i change the line of code below to paste to sheet1 range L1. I I cant seem to come up with something that will work. (the rest of my code is ok -- I just cant seem to get by this line -- it wants to paste to sheet2)

thanks for any help

John


Code:
With ActiveSheet.QueryTables.Add(Connection:= _
        "URL;http://www.xxxxxxxx.com/table1.htm", Destination:=Range("L1"))
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hi John,

If you push a button on Sheet2 and don't qualify the reference, VBA assumes that you want to paste to the same sheet. Try:
Code:
With ActiveSheet.QueryTables.Add(Connection:= _ 
        "URL;http://www.xxxxxxxx.com/table1.htm", Destination:=Sheets("Sheet1").Range("L1"))
Denis
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,192
Members
449,072
Latest member
DW Draft

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top