Hello need some help with the below code but an explanation in what I am needing might help you.
I am creating a macro that takes external data( FX rates) and places them down in a specified range on sheet1. sheet2 has just a little sum conversion using the FX rate from sheet1 to give GBP rate. This will live conversions when people fill in expenses for me on a project.
My issue is making the macro select the correct sheet. I have come up with the below however. i'm now getting a runtime error 13.type mismatch.
before it just selected the activesheet and not the sheet I wanted.
hope you guys can help. All new to VBA and i cannot find right answer when researching. so any help will be greatly appreciated.
regards. Ross
Sub fxRate()
'
' fxRate Macro
'
'
Set activateFXSheet = Sheet1.Activate
Set FXSheet = activateFXSheet.QueryTables.Add(Connection:= _
"URL;http://www.x-rates.com/table/?from=USD&amount=1", Destination:=Range( _
"$C$4:$E$14"))
With FXSheet
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "1"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub