ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   run time error 13 type mismatch (https://www.excelbanter.com/excel-programming/304492-re-run-time-error-13-type-mismatch.html)

kkknie[_170_]

run time error 13 type mismatch
 
You could check for a number first before doing anything...


Code
-------------------
Private Sub Worksheet_Calculate()

Dim Inrange As Range
Dim rng As Range
Set Inrange = Range("B16,B58,T4,T15,T23,T50")
For Each rng In Inrange.Cells

If Not IsNumeric(rng.Value) Then
If rng.Value = "c" Then
rng.Font.Name = "Wingdings 3"
Else
rng.Font.Name = "Webdings"
End If
End If

Next rng

End Su
-------------------

Throw an Else in there if you want to do something if the value is
number.



--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 02:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com