Getting table from a link from a cell value

adipat

New Member
Joined
Jul 2, 2022
Messages
4
Office Version
  1. 2021
  2. 2019
  3. 2016
Platform
  1. Windows
Hello,

I hope someone can help me with this vba. this works for all links in a cell value but 1. I cant get a table from that link. I tried to go to that link from cell directly and it works fine.

VBA Code:
Sub PPA1()
Dim www1 As String
Dim sht As Worksheet
Dim lastrow As Integer
Dim URL$(0 To 1)

Application.ScreenUpdating = False
Application.EnableEvents = False
Application.Calculation = xlCalculationManual

Set sht = ThisWorkbook.Sheets("PPA1")
lastrow = Sheets("PPA1").Cells(Rows.Count, 2).End(xlUp).Row

Worksheets("PPA1").Range("A:F").Clear
www1 = Sheets("Instructions").Range("f14")

With sht.QueryTables.Add(Connection:= _
"URL;" & www1 _
, Destination:=sht.Cells(1, 1))
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False

End With
Application.CutCopyMode = False

With ThisWorkbook
For lngConn = .Connections.Count To 1 Step -1
.Connections(lngConn).Delete
Next lngConn
End With
Application.Calculation = xlAutomatic
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Forum statistics

Threads
1,215,046
Messages
6,122,852
Members
449,096
Latest member
Erald

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