Runtime error 13 excel macros

irunfast5

New Member
Joined
Jun 29, 2012
Messages
1
I was just sent a new workbook with macros to use to track my numbers at my new job. This particular macro is used to combine all the different sheets into one master sheet. When I try to run it, i get runtime error 13:type mismatch. Here is the code from the debugger. The error is coming from between the ** **. I am running excel 2010 on windows 7. PLease help, as I am completely clueless to what's going wrong.




Sub RankManagers()
Dim i, j As Integer
Dim AppTot, PremTot, UWATot As Variant


Range("K1").Select
ActiveCell.FormulaR1C1 = "=COUNTA(R[2]C[-2]:R[4999]C[-2])"
j = Range("K1").Value + 2
i = 3
AppTot = 0
PremTot = 0
UWATot = 0


For i = 3 To j
Cells(i, 8).Value = i - 2
Cells(i, 12).FormulaR1C1 = "=COUNTIF(R3C4:R5000C4,RC[-3])"
**AppTot = AppTot + Cells(i, 10)
PremTot = PremTot + Cells(i, 11)
UWATot = UWATot + Cells(i, 12)**
Next i


Range(Cells(3, 8), Cells(j, 8)).Select
With Selection
.HorizontalAlignment = xlRight
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Columns.AutoFit
Selection.Font.Bold = True
Range("K1").Select
Selection.ClearContents
Range("A1").Select

Cells(j + 1, 9).FormulaR1C1 = "Totals:"
Selection.Font.Bold = True
Cells(j + 1, 10).Value = AppTot
Cells(j + 1, 11).Value = PremTot
Cells(j + 1, 12).Value = UWATot
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
What's probably happening is that one of those variables is trying to add numbers to letters or letters to numbers. You can add text "a"+"b" and get "ab" or numbers 1+2 to get 3 but you can't mix them.

When the code breaks, leave it in break mode and see which line is the problem. What's it trying to add?
 
Upvote 0

Forum statistics

Threads
1,215,366
Messages
6,124,516
Members
449,168
Latest member
CheerfulWalker

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top