Hi all,
I got this code and I got the feeling it's possible to simplify it.
Got this piece of code alot for a whole set of ranges (column K, M, P, R and on).
It take some time to write so if it's possible to simplify it will help me alot
I got this code and I got the feeling it's possible to simplify it.
Got this piece of code alot for a whole set of ranges (column K, M, P, R and on).
It take some time to write so if it's possible to simplify it will help me alot
VBA Code:
If (Target.Count = 1) Then
Application.EnableEvents = False
If (Not Intersect(Target, Me.Range("K:K")) Is Nothing) Then
If Target = vbNullString Then
Target.Offset(0, 1) = vbNullString
Target.Offset(0, 2).Borders(xlEdgeTop).LineStyle = xlNone
Target.Offset(0, 2).Borders(xlEdgeBottom).LineStyle = xlNone
Target.Offset(0, 2).Borders(xlEdgeLeft).LineStyle = xlNone
Target.Offset(0, 2).Borders(xlEdgeLeft).LineStyle = xlContinuous
Target.Offset(0, 2).Borders(xlEdgeRight).Color = RGB(0, 0, 0)
Target.Offset(0, 3).Borders(xlEdgeTop).LineStyle = xlNone
Target.Offset(0, 3).Borders(xlEdgeBottom).LineStyle = xlNone
Target.Offset(0, 3).Borders(xlEdgeRight).LineStyle = xlNone
Else
Target.Offset(0, 1) = Date
Target.Offset(0, 2).Borders(xlEdgeTop).LineStyle = xlContinuous
Target.Offset(0, 2).Borders(xlEdgeTop).Color = RGB(255, 0, 0)
Target.Offset(0, 2).Borders(xlEdgeBottom).LineStyle = xlContinuous
Target.Offset(0, 2).Borders(xlEdgeBottom).Color = RGB(255, 0, 0)
Target.Offset(0, 2).Borders(xlEdgeLeft).Color = RGB(255, 0, 0)
Target.Offset(0, 2).Borders(xlEdgeRight).Color = RGB(255, 0, 0)
Target.Offset(0, 3).Borders(xlEdgeTop).LineStyle = xlContinuous
Target.Offset(0, 3).Borders(xlEdgeTop).Color = RGB(255, 0, 0)
Target.Offset(0, 3).Borders(xlEdgeBottom).LineStyle = xlContinuous
Target.Offset(0, 3).Borders(xlEdgeBottom).Color = RGB(255, 0, 0)
Target.Offset(0, 3).Borders(xlEdgeRight).LineStyle = xlContinuous
Target.Offset(0, 3).Borders(xlEdgeRight).Color = RGB(255, 0, 0)
End If
End If
End If
Application.EnableEvents = True