I get error: Runtime error 13 : incompatible types

elmnas

Board Regular
Joined
Feb 20, 2015
Messages
206
Hello people I have made following code but It was a time ago...

I get error: Runtime error 13 : incompatible types

see code below

Code:
Sub CheckIND()

'IND=IND CHECK FIL;;;;;;;;;;;;;;;;;;;;;;
For I = 2 To ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).row
    If Cells(I, "J") = "IND" And Cells(I, "K") = "IND" And Len(Cells(I, "B")) <> 0 And Cells(I, "AB") <> 0 Then
    Cells(I, 1).EntireRow.Interior.ColorIndex = 6
    mycell = Cells(I, "B").Text
    mycellRes = mycell - 1
    DivAB = Cells(I, "AB").Text
    myTot = Round(DivAB / mycellRes)
    ValueSought = Cells(I, "A").Value
    Set FirstInstance = Columns("A").Find(what:=ValueSought, LookIn:=xlFormulas, LookAt:=xlWhole, SearchFormat:=False)
        If Not FirstInstance Is Nothing Then Set RangeToSearch = Range(FirstInstance, Cells.SpecialCells(xlCellTypeLastCell)).Columns(1)
        RangeToSearchFirstRow = FirstInstance.row
        RangeToSearchValues = RangeToSearch.Value
        Set RangeToUpdate = FirstInstance
        For j = 1 To UBound(RangeToSearchValues)
        If RangeToSearchValues(j, 1) = ValueSought Then
        Set RangeToUpdate = Union(RangeToUpdate, Cells(j - 1 + RangeToSearchFirstRow, "A"))
        End If
    Next j
    RangeToUpdate.Offset(, 19).Value = myTot
    End If
Next I
End Sub


when I see troubleshoots the problem the error is:
myTot = Round(DivAB / mycellRes)
Could someone help me ?

Thank you in advance
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
put Option Explicit at the top of the module
 
Upvote 0

Forum statistics

Threads
1,215,692
Messages
6,126,230
Members
449,303
Latest member
grantrob

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