View Single Post
 
Old 08-19-2015, 11:27 PM
saurabhlotankar saurabhlotankar is offline Windows XP Office 2010 32bit
Novice
 
Join Date: May 2015
Posts: 29
saurabhlotankar is on a distinguished road
Default

Hi NoSparks,

I have written the below mentioned code for highlighting duplicate values if any in column D.

Public Sub MarkDuplicates()
Dim iWarnColor As Integer
Dim rng As Range
Dim rngCell As Variant
Dim myRangeUpdateAA As Range


Set rLastCell = ActiveSheet.Cells.Find("*", ActiveSheet.Cells(1, 1), , , xlByRows, _
xlPrevious)
lastrow = rLastCell.Row
Set rng = ActiveSheet.Range("D3" & lastrow)
iWarnColor = xlThemeColorAccent2
For Each rngCell In rng.Cells
vVal = rngCell.Text
If (WorksheetFunction.CountIf(rng, vVal) = 1) Then
rngCell.Interior.Pattern = xlNone
Else
rngCell.Interior.ColorIndex = iWarnColor
End If
Next rngCell
End Sub

Now am stuck on how to incorporate this code with our earlier code. So that our final macro will be ready with both condiotions i.e. no mandatory fields should be blank and there should not be any duplcate value in column D. In both pop msg should populate and mail should not be drafted.

Request you to kindly assist.

Thanks a lot.
Reply With Quote