How do I convert this code to a macro?


[VBA]Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim myrange, a, b As Range, rep(150) As Integer
On Error GoTo ErrHandler
Application.EnableEvents = False
rr = Target.Row
x = [B1].Offset(rr - 1, 0)
'=======================================================
Set myrange = Range("B14:B18")
'=======================================================
Range("B14:K18").Interior.Pattern = xlNone
i = 0
'=======================================================
Columns("k").ClearContents
For Each s In myrange
y = s.Value
If y = x Then
i = i + 1
Range("B" & s.Row, "J" & s.Row).Interior.ColorIndex = 42
rep(i) = s.Row
End If
Next s
sum_nj = 0: chg = 0
For j = 1 To i
Set a = Range("H" & rep(j))

For nj = 1 To i
Set b = Range("J" & rep(nj))
Set U = Range("K" & rep(nj))
If b.Value <> a.Value Then chg = 1: b.Interior.ColorIndex = 3
If b.Value <> a.Value Then chg = 1: U.Interior.ColorIndex = 36
Next nj

Next j


'''''''
If chg <> 0 Then
For j = 1 To i
sum_nj = sum_nj + Range("G" & rep(j)).Value
Next j
End If
If sum_nj <> 0 Then Range("k" & rep(1)).Value = sum_nj

ErrHandler:
Application.EnableEvents = True
End Sub[/VBA]