I am having a problem with this code,
Private Sub CommandButton4_Click()
Dim DesCount As Integer
Dim DesCount2 As Integer
Dim DesCount3 As Integer
Dim DesFile As String
Dim Bs As String
DesFile = ActiveWorkbook.Name
DesCount = Application.WorksheetFunction.CountA(Workbooks(DesFile).Sheets("Invoice").Range("A:A"))
DesCount2 = Application.WorksheetFunction.CountA(Workbooks(DesFile).Sheets("Paid").Range("A:A"))
DesCount3 = Application.WorksheetFunction.CountA(Workbooks(DesFile).Sheets("DCN-Log").Range("C:C"))
For a = 2 To DesCount
For b = 2 To DesCount2
If Workbooks(DesFile).Sheets("Invoice").Range("A" + a).Value = Workbooks(DesFile).Sheets("Paid").Range("A" + b).Value Then Call Update_Cell(DesFile, "A", a)
Next b
For c = 2 To DesCount3
If Workbooks(DesFile).Sheets("Invoice").Range("A" + a).Value = Workbooks(DesFile).Sheets("DCN-Log").Range("C" + c).Value Then Call Update_Cell2(DesFile, "A", a) Else Call Update_Cell3(DesFile, "A", a)
If Workbooks(DesFile).Sheets("Invoice").Range("B" + a).Value = Workbooks(DesFile).Sheets("DCN-Log").Range("B" + c).Value Then Call Update_Cell2(DesFile, "A", a) Else Call Update_Cell3(DesFile, "A", a)
If Workbooks(DesFile).Sheets("Invoice").Range("C" + a).Value = Workbooks(DesFile).Sheets("DCN-Log").Range("F" + c).Value Then Call Update_Cell2(DesFile, "A", a) Else Call Update_Cell3(DesFile, "A", a)
If Workbooks(DesFile).Sheets("Invoice").Range("L" + a).Value = Workbooks(DesFile).Sheets("DCN-Log").Range("K" + c).Value Then Call Update_Cell2(DesFile, "A", a) Else Call Update_Cell3(DesFile, "A", a)
If Workbooks(DesFile).Sheets("Invoice").Range("F" + a).Value = Workbooks(DesFile).Sheets("DCN-Log").Range("O" + c).Value Then Call Update_Cell2(DesFile, "A", a) Else Call Update_Cell3(DesFile, "A", a)
Next c
Next a
End Sub
The macro will not run this IF loop which calls a macro to highlight a cell if the values match. I get a type mismatch error when it comes to the veritable. If the range is changed to a set value the macro works but I can't figure out why this error is occurring. Could someone help me with this?
Bookmarks