I created a macro for the file, and at first it worked fine, but today I opened and restarted the file and the macro hundreds of times, and I always get the following error: Excel VBA Runtime Error '13' Type Mismatch
I havenβt changed anything in the macro and donβt know why I am getting an error. In addition, it takes time to update the macro every time I run it (the macro should run about 9000 lines).
The error is between ** **.
VBA:
Sub k() Dim x As Integer, i As Integer, a As Integer Dim name As String name = InputBox("Please insert the name of the sheet") i = 1 Sheets(name).Cells(4, 58) = Sheets(name).Cells(4, 57) x = Sheets(name).Cells(4, 57).Value Do While Not IsEmpty(Sheets(name).Cells(i + 4, 57)) a = 0 If Sheets(name).Cells(4 + i, 57) <> x Then If Sheets(name).Cells(4 + i, 57) <> 0 Then If Sheets(name).Cells(4 + i, 57) = 3 Then a = x Sheets(name).Cells(4 + i, 58) = Sheets(name).Cells(4 + i, 57) - x x = Cells(4 + i, 57) - x End If **Sheets(name).Cells(4 + i, 58) = Sheets(name).Cells(4 + i, 57) - a** x = Sheets(name).Cells(4 + i, 57) - a Else Cells(4 + i, 58) = "" End If Else Cells(4 + i, 58) = "" End If i = i + 1 Loop End Sub
Do you think you can help me? I am using excel 2010 for windows 7. Thanks a lot
excel-vba excel-2010
Diogo
source share