Automatic Bolding and BackColoring

  • Thread starter Thread starter OriginalStealth
  • Start date Start date
O

OriginalStealth

ID TITLE TitleID

66749 Devil's Advocate 323484
66750 Warner Cable 3 301350
66750 Warner Cable 3 301350
66750 Warner Cable 3 301350
66750 Warner Cable 3 301350
66795 Paycheck 322940

1. How can I double-click on the ID and have the whole
line bold and the row changes to yellow.

2. When I click an ID that has duplicates beneath it, the
first line bolds and all of them turn yellow
 
Hi
try the following code (put this in your worksheet module, not in a
standard module):
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
Dim i
If Intersect(Target, Me.Range("A1:A100")) Is Nothing _
Then Exit Sub
If Target.Cells.Count > 1 Then Exit Sub

Application.ScreenUpdating = False
Application.EnableEvents = False
On Error GoTo errhandler

With Rows("1:100")
.Interior.ColorIndex = xlNone
.Font.Bold = False
End With

With Target.EntireRow
.Interior.ColorIndex = 6
.Font.Bold = True
End With

For i = Target.Row + 1 To 100
If Me.Cells(i, 1) = Target.Value Then
Me.Rows(i).Interior.ColorIndex = 6
End If
Next

errhandler:
Application.ScreenUpdating = True
Application.EnableEvents = True
Cancel = True
End Sub
 
Back
Top