S
Sabosis
Hello-
I have a macro that works perfect in 2003, but 2007 is kicking up a
runtime error '13' "type mismatch". Does anyone have an idea why this
code will no longer work?
Sub GetTotalA()
Dim rngAllValues As Range
Dim rngCurrent As Range
Dim wks As Worksheet
Dim dblTotal As Double
Set wks = ActiveSheet
With wks
Set rngAllValues = .Range(.Range("H5"), _
.Cells(Rows.Count, "H").End(xlUp).Offset(-1, 0))
End With
dblTotal = Application.Sum(rngAllValues)
For Each rngCurrent In rngAllValues
rngCurrent.Offset(0, 1).Value = rngCurrent.Value / dblTotal 'This
is the line showing the error
Next rngCurrent
End Sub
I have a macro that works perfect in 2003, but 2007 is kicking up a
runtime error '13' "type mismatch". Does anyone have an idea why this
code will no longer work?
Sub GetTotalA()
Dim rngAllValues As Range
Dim rngCurrent As Range
Dim wks As Worksheet
Dim dblTotal As Double
Set wks = ActiveSheet
With wks
Set rngAllValues = .Range(.Range("H5"), _
.Cells(Rows.Count, "H").End(xlUp).Offset(-1, 0))
End With
dblTotal = Application.Sum(rngAllValues)
For Each rngCurrent In rngAllValues
rngCurrent.Offset(0, 1).Value = rngCurrent.Value / dblTotal 'This
is the line showing the error
Next rngCurrent
End Sub