open an excel file
activate sheet1
try this macro
Sub exchangerates()
Dim cfind As Range
Worksheets("sheet1").Activate
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.imf.org/external/np/fin/data/rms_mth.aspx?reportType=REP", _
Destination:=Range("A1"))
.Name = "rms_mth.aspx?reportType=REP"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
Set cfind = ActiveSheet.Columns("A:A").Find(what:="currency", lookat:=xlWhole)
Range(Range("A1"), cfind.Offset(-1, 0)).EntireRow.Delete
Set cfind = ActiveSheet.Columns("A:A").Find(what:="disclaimer", lookat:=xlWhole)
Range(cfind, Cells(Rows.Count, "A").End(xlUp)).EntireRow.Delete
Range("a1").Select
End Sub
Bookmarks