
You can change the highlighted text to any other website, for example the code below will connect to the website : The highlighted part below defines the URL of the website to connect to: With Sheets("Sheet3").QueryTables.Add(Connection:= _ĭestination:=Sheet3.Range(Sheet3.Cells(2, 2), _įor more information about the different methods of referring sheets in VBA please see the link below: For example the code below will insert the query table in cell B2 of sheet3: We could change the code above to insert the query table in a different location. The default code inserts the query table in cell A1 in the active sheet: The highlighted parts below define the location the query table will be inserted. The next 3 lines of code are very important: This is only necessary if you want the Query Table to appear in a new sheet:

The first line of code creates a new worksheet. You will end up with a code similar to the one below: The first step would be to record the steps used in the article Excel Getting Data From the Web using the macro recorder.
