DavidVernon
Board Regular
- Joined
- Jun 30, 2006
- Messages
- 71
Hi everyone
I'm trying to combine the two macro's below so that they can be ran from one button. I'm struggling because of the scripting.dictionary. Because both macro's use this object, I'm not sure if it is possible to combine them. Any thoughts?
Sub delete_duplicate_invoice_values()
Dim Rng As Range, Dn As Range
Dim Txt As String, Ray
With CreateObject("scripting.dictionary")
.comparemode = vbTextCompare
Set Rng = Range(Range("U2"), Range("U" & Rows.Count).End(xlUp))
ReDim Ray(1 To Rng.Count, 1 To 3)
For Each Dn In Rng
Txt = Dn & Dn.Offset(, -20) & Dn.Offset(, -17)
If Not .Exists(Txt) Then
.Add Txt, ""
Else
Dn.Resize(, 1).ClearContents
End If
Next Dn
End With
End Sub
Sub delete_duplicate_credit_foc_values()
Dim Rng As Range, Dn As Range
Dim Txt As String, Ray
With CreateObject("scripting.dictionary")
.comparemode = vbTextCompare
Set Rng = Range(Range("T2"), Range("T" & Rows.Count).End(xlUp))
ReDim Ray(1 To Rng.Count, 1 To 3)
For Each Dn In Rng
Txt = Dn & Dn.Offset(, -19) & Dn.Offset(, -16)
If Not .Exists(Txt) Then
.Add Txt, ""
Else
Dn.Resize(, 1).ClearContents
End If
Next Dn
End With
End Sub
I'm trying to combine the two macro's below so that they can be ran from one button. I'm struggling because of the scripting.dictionary. Because both macro's use this object, I'm not sure if it is possible to combine them. Any thoughts?
Sub delete_duplicate_invoice_values()
Dim Rng As Range, Dn As Range
Dim Txt As String, Ray
With CreateObject("scripting.dictionary")
.comparemode = vbTextCompare
Set Rng = Range(Range("U2"), Range("U" & Rows.Count).End(xlUp))
ReDim Ray(1 To Rng.Count, 1 To 3)
For Each Dn In Rng
Txt = Dn & Dn.Offset(, -20) & Dn.Offset(, -17)
If Not .Exists(Txt) Then
.Add Txt, ""
Else
Dn.Resize(, 1).ClearContents
End If
Next Dn
End With
End Sub
Sub delete_duplicate_credit_foc_values()
Dim Rng As Range, Dn As Range
Dim Txt As String, Ray
With CreateObject("scripting.dictionary")
.comparemode = vbTextCompare
Set Rng = Range(Range("T2"), Range("T" & Rows.Count).End(xlUp))
ReDim Ray(1 To Rng.Count, 1 To 3)
For Each Dn In Rng
Txt = Dn & Dn.Offset(, -19) & Dn.Offset(, -16)
If Not .Exists(Txt) Then
.Add Txt, ""
Else
Dn.Resize(, 1).ClearContents
End If
Next Dn
End With
End Sub