I have a list of URLs in sheet1 for web query. In few of the URLs to work this below code need run. Because few of those urls gives the result in column A, B, C or D and I want the results in column A. It will be great if I can mention the the sheet no in code. Can anybody help me please.
Sub Macro6()
'
' Macro6 Macro
'
'
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://", Destination:=Range( _
"$A$1"))
.Name = "control"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingAll
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
Range("B1:B5").Select
Range("B5").Activate
Selection.Cut
Range("C1:C5").Select
Range("C5").Activate
Selection.Cut
Range("D1:D5").Select
Range("D5").Activate
Selection.Cut
Range("A16").Select
End Sub
Bookmarks