Eloise T
Active Member
I have six, inefficiently written no doubt, but working segments in this VBA that have been removed for space consideration (10,000 word limit).
The VBA segment notated as "Column B" needs to be adjusted so it will Conditionally Format B7:B257 to find duplicates. (see picture below)
I have tried several times (at least 5) to Record Macro of selecting the "Format only unique or duplicate values" but only get:
Sub Macro1()
.
.
End Sub
Sub Macro2()
.
.
End Sub
etc.
What is the VBA code necessary to find duplicates?
More importantly, what is the secret to get Macros to Record more than Sub Macro1() .... End Sub?
Thank you.
![upload_2017-9-9_9-40-2.png upload_2017-9-9_9-40-2.png](https://chandoo.org/forum/data/attachments/45/45350-2fe46a426bf4026e6aeacbe8fb2be250.jpg)
The VBA segment notated as "Column B" needs to be adjusted so it will Conditionally Format B7:B257 to find duplicates. (see picture below)
I have tried several times (at least 5) to Record Macro of selecting the "Format only unique or duplicate values" but only get:
Sub Macro1()
.
.
End Sub
Sub Macro2()
.
.
End Sub
etc.
What is the VBA code necessary to find duplicates?
More importantly, what is the secret to get Macros to Record more than Sub Macro1() .... End Sub?
Thank you.
![upload_2017-9-9_9-40-2.png upload_2017-9-9_9-40-2.png](https://chandoo.org/forum/data/attachments/45/45350-2fe46a426bf4026e6aeacbe8fb2be250.jpg)
Code:
Sub Conditional_Format_Reset()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If ws.Cells(Rows.Count, 3).End(xlUp).Row > 6 Then
' (Rows.Count, 3) tells ...?
'Column B ------------------------------------------------------------------------------------------
With ws.Range("B7:B257")
.FormatConditions.Delete
NEED FORMULA HERE .FormatConditions.Add Type:=xlExpression, Formula1:="=?????????????????????,$B7)))"
.FormatConditions(.FormatConditions.Count).Font.Bold = True 'Bold font
.FormatConditions(.FormatConditions.Count).Font.ColorIndex = 3 'Red font
.FormatConditions(.FormatConditions.Count).Interior.Pattern = xlPatternLinearGradient
.FormatConditions(.FormatConditions.Count).Interior.Gradient.Degree = 0
.FormatConditions(.FormatConditions.Count).Interior.Gradient.ColorStops.Clear
.FormatConditions(.FormatConditions.Count).Interior.Gradient.ColorStops.Add (0)
.FormatConditions(.FormatConditions.Count).Interior.Gradient.ColorStops.Add(0).Color = RGB(255, 153, 255)
.FormatConditions(.FormatConditions.Count).Interior.Gradient.ColorStops.Add(0).TintAndShade = 0
.FormatConditions(.FormatConditions.Count).Interior.Gradient.ColorStops.Add(0).Color = RGB(255, 153, 255)
.FormatConditions(.FormatConditions.Count).Interior.Gradient.ColorStops.Add(0).TintAndShade = 0.25
.FormatConditions(.FormatConditions.Count).Interior.Gradient.ColorStops.Add(0).Color = RGB(255, 153, 255)
.FormatConditions(.FormatConditions.Count).Interior.Gradient.ColorStops.Add(0).TintAndShade = 0.5
.FormatConditions(.FormatConditions.Count).Interior.Gradient.ColorStops.Add(0).Color = RGB(255, 153, 255)
.FormatConditions(.FormatConditions.Count).Interior.Gradient.ColorStops.Add(0).TintAndShade = 0.75
.FormatConditions(.FormatConditions.Count).Interior.Gradient.ColorStops.Add(1).Color = RGB(255, 153, 255)
.FormatConditions(.FormatConditions.Count).StopIfTrue = False
End With
'Column O ------------------------------------------------------------------------------------------
' Sq.rt. chr ASCII 8730
With ws.Range("O7:O257")
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="=($O7=""CheckMark"")*($C7>$L7)"
.FormatConditions(.FormatConditions.Count).Font.Bold = True 'Bold font
.FormatConditions(.FormatConditions.Count).Font.ColorIndex = 3 'Red font
' .FormatConditions(.FormatConditions.Count).Interior.ColorIndex = 2 'White background (white assumed)
.FormatConditions(.FormatConditions.Count).StopIfTrue = False
' End With
'Column O ------------------------------------------------------------------------------------------
' Sq.rt.chr. &H221A
' With ws.Range("O7:O257")
' .FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="=AND($O7=""CheckMark"",$C7<$L7)"
.FormatConditions(.FormatConditions.Count).Font.Bold = True 'Bold font
.FormatConditions(.FormatConditions.Count).Font.ColorIndex = 3 'Red font
' .FormatConditions(.FormatConditions.Count).Interior.ColorIndex = 2 'White background (white assumed)
.FormatConditions(.FormatConditions.Count).StopIfTrue = False
End With
End If 'Concludes: If ws.Cells(Rows.Count, 3).End(xlUp).Row > 2 Then
Next 'Concludes: For Each ws In ThisWorkbook.Worksheets
'THREE BEEPS----------------------------------------------------------------------------------------
Beep
' Pause a second before engaging the next Beep so they don't run together and sound like only one Beep.
' hrs:mi:secs
Application.Wait Now + TimeValue("0:00:01")
Beep
' Pause a second before engaging the next Beep so they don't run together and sound like only one Beep.
Application.Wait Now + TimeValue("0:00:01")
Beep
End Sub