Chris Waller
Board Regular
- Joined
- Jan 18, 2009
- Messages
- 183
- Office Version
- 365
- Platform
- Windows
Hi, Can anyone help me with a macro which was previously working, but when I have move to another PC the macro appears to be generating a Run-Time Error '13' Type Mismatch. I have highlighted in red the text which is where the macro is throwing this error. I just don't know what the problem is. TIA
Rich (BB code):
Sub Search()
Call FindGrade("A3-1G", 10)
Call FindGrade("A4-1G", 41)
Call FindGrade("A6-16G", 99)
End Sub
Sub FindGrade(grade As String, amount)
Dim found As Range
Set found = Sheet1.Range("A1").EntireColumn.Find( _
What:=grade, _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
If Not found Is Nothing Then
found.Offset(0, 5).Range("A1").FormulaR1C1 = "=ROUND(SUMIF(C[-1],""" & grade & """,C[-2])/7.5,2)"
With found.Offset(0, 1).Range("A1")
.FormulaR1C1 = "=RC[-1]*" & amount
.NumberFormat = "$#,##0.00"
End With
End If
End Sub
Last edited by a moderator: