LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default run time error 13 type mismatch

Hi Jodi,

The only circumstances that I know of that would cause this error in the
code you've shown below is if one of the cells that you are looping through
contains an error value. Try placing a check for an error value prior to
testing for the character like so:

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 IsError(rng.Value) Then
If rng.Value = "c" Then
rng.Font.Name = "Wingdings 3"
Else
rng.Font.Name = "Webdings"
End If
End If
Next rng

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Jodi" wrote in message
...
VBA Specialists,

I am receiving a run time error 13 type mismatch, with this line

highlighted:
If rng.Value = "c" Then

I have a workbook with 27 worksheets. 23 of the 27 are identical and use

the following 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 rng.Value = "c" Then
rng.Font.Name = "Wingdings 3"
Else
rng.Font.Name = "Webdings"
End If
Next rng

End Sub

4 of the 27 are slightly different and have a different range
Range("B16,B58,T4,T20,T34,T50")
In these 4 worksheets, cells T15 and T23 contain text strings. I know this

is causing the problem, but I want to know is there a way to easily solve
this?

The worksheets still function as designed, but a message box continuously

pops up that must be clicked and is quite annoying. Thanks for any
assistance.

Jodi



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Basic Error Run Time Error, Type Mismatch Meg Partridge Excel Discussion (Misc queries) 12 September 10th 08 06:10 PM
run-time error 13: Type mismatch? Marko Enula Excel Discussion (Misc queries) 2 February 5th 08 01:00 PM
run time error 13 type mismatch kkknie[_170_] Excel Programming 0 July 20th 04 03:28 PM
Run Time Error '13' Type mismatch David Adamson[_3_] Excel Programming 2 June 10th 04 04:00 AM


All times are GMT +1. The time now is 06:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"