I am trying to export from a web page ( link ) the data of the table 1 Colombian Peso Rates table . The problem is that I do not export the date. Someone can help me with that.Annex image of the table to export table and image after exporting the table to excel.
Thank you.
The code I am using is the following:
Sub Actualizar_datos()
'Ejecutamos a la macro Elimina_Datos para eliminar la conexión, la querytable y los datos
Call Elimina_Datos
'Creamos nueva conexión con la web que contiene la tabla o datos que necesitamos
With Sheets("CONVERSION").QueryTables.Add(Connection:=
"URL;https://xe.com/currencytables/?from=COP&date=2018-05-09", Destination:=Range("$A$1"))
'indicamos el nombre de la querytable, debemos acabarla con _1 de lo contrario, el sistema otorgará un valor numérico
.Name = "Colombian Peso Rates table"
'ajustamos las columnas
.AdjustColumnWidth = True
'actualizamos los datos cada minuto
.RefreshPeriod = 60
'descargamos los datos de la tabla 1
.WebTable = "1"
'actualizamos datos en segundo plano
.Refresh BackgroundQuery:=False
End With
End Sub
Sub Elimina_Datos()
Application.ScreenUpdating = False
Dim cnn As Object
'eliminamos la conexión que hemos creado
For Each cnn In ThisWorkbook.Connections
If ActiveWorkbook.Connections.Count > 0 Then cnn.Delete
Next cnn
With Sheets("CONVERSION")
filas = Application.CountA(.Range("A:A"))
columnas = Application.CountA(.Range("1:1"))
'eliminamos todos los contenidos de la tabla
'Eliminamos la tabla
If filas And columnas > 0 Then
.Range(Cells(1, 1), Cells(filas, columnas)).Select
Selection.ClearContents
Selection.QueryTable.Delete
.Range("A1").Select
End If
End With
Application.ScreenUpdating = True
End Sub