Junji Qian
01-24-2017, 12:46 PM
Hey Guys,
I have met the error when I run the code. Object required (Error 424)
I have checked all the variables and they are all properly dimed.
This code is designed to catch the sequential transactions for a bank. When there are a pair of sequential number in the same column (they are bold already), we would like to mark the larger one as "Dupe of ###".
Please see the code as following:
Thank you very much!
---------------------------------------------------------------------------------------------
Sub Label()
Dim j As Variant
Dim Duplicate As Variant
For j = 60000 To 2 Step -1
Duplicate = Sheets("To_DD comparison").Cells(j, 10).Value
If Duplicate.DisplayFormat.Font.Bold = True Then
If Exist(Duplicate) And Exist(Duplicate - 1) Then
Sheets("To_DD comparison").Cells(j, 17).Value = "Dupe of" & Duplicate - 1
End If
End If
Next j
End Sub
Function Exist(intNum) As Boolean
Exist = False
lastrow = Sheets("To_DD comparison").Range("A60000").End(xlUp).Row
For i = 2 To lastrow
If intNum = Sheets("To_DD comparison").Cells(i, 10).Value Then
Exist True
End If
Next
End Function
I have met the error when I run the code. Object required (Error 424)
I have checked all the variables and they are all properly dimed.
This code is designed to catch the sequential transactions for a bank. When there are a pair of sequential number in the same column (they are bold already), we would like to mark the larger one as "Dupe of ###".
Please see the code as following:
Thank you very much!
---------------------------------------------------------------------------------------------
Sub Label()
Dim j As Variant
Dim Duplicate As Variant
For j = 60000 To 2 Step -1
Duplicate = Sheets("To_DD comparison").Cells(j, 10).Value
If Duplicate.DisplayFormat.Font.Bold = True Then
If Exist(Duplicate) And Exist(Duplicate - 1) Then
Sheets("To_DD comparison").Cells(j, 17).Value = "Dupe of" & Duplicate - 1
End If
End If
Next j
End Sub
Function Exist(intNum) As Boolean
Exist = False
lastrow = Sheets("To_DD comparison").Range("A60000").End(xlUp).Row
For i = 2 To lastrow
If intNum = Sheets("To_DD comparison").Cells(i, 10).Value Then
Exist True
End If
Next
End Function