NewOrderFac33
Well-known Member
- Joined
- Sep 26, 2011
- Messages
- 1,283
- Office Version
- 2016
- 2010
- Platform
- Windows
Good morning, I'm trying to write a function to search and replace, thus:
but when I attempt to run my code. I get "Runtime error 13 Type Mismatch" with the "Select Case" line highlighted.
Can anyone suggest where I'm going wrong, please?
Thanks in advance - Pete
Code:
Set AnimalColumn = Sheets("Database").Range("Col_AnimalType")
ReplaceWithSpecies AnimalColumn
Function ReplaceWithSpecies(RangeToProcess As Range)
With RangeToProcess
Select Case UCase(.Formula)
Case Is = "Tiger", "Lion"
.Formula = "Cat"
Case "Labrador", "Alsatian"
.Formula = "Dog"
Case Else
.Formula = "Fish"
End Select
End With
End Function
but when I attempt to run my code. I get "Runtime error 13 Type Mismatch" with the "Select Case" line highlighted.
Can anyone suggest where I'm going wrong, please?
Thanks in advance - Pete