Hi, I am using the following code to find and replace function in a workbook
when the code gets to the cells,replace part of the macro I get the Run-time Error 13 Type Mismatch. Anyone have any suggestions?
VBA Code:
Sub WeffUpdate()
Dim wb As Workbook
Dim ws As Worksheet
Dim strFind As String
Dim strRepl As String
Set wb = ThisWorkbook
For Each ws In wb.Worksheets
Application.DisplayAlerts = False
strFind = "SUM('https://company.sharepoint.com/sites/Forecast/[Reduction Plan_Aug2020_Baseline Input_V2.xlsx]IBP2 Aug 2020'!$F$68:F$68)+SUM('https://company.sharepoint.com/sites/Forecast/[Reduction Plan_Aug2020_Baseline Input_V2.xlsx]IBP2 Aug 2020'!$F$74:F$74)"
strRepl = "SUM('https://company.sharepoint.com/sites/Forecast/[Reduction Plan_Sep2020_30.09.xlsx]IBP2.v2 Sep20'!$F$56:F$56)+SUM('https://company.sharepoint.com/sites/Forecast/[Reduction Plan_Sep2020_30.09.xlsx]IBP2.v2 Sep20'!$E$61:E$61)"
'Debug.Print strFind
'Debug.Print strRepl
'Debug.Print ws.Name
If CBool(InStr(1, ws.Name, "London")) = True Then
ws.Cells.Replace _
what:=strFind, _
replacement:=strRepl, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False, _
SearchFormat:=False, _
ReplaceFormat:=False, _
FormulaVersion:=xlReplaceFormula2
End If
Next ws
Application.DisplayAlerts = True
End Sub
when the code gets to the cells,replace part of the macro I get the Run-time Error 13 Type Mismatch. Anyone have any suggestions?