Macropheliac
Board Regular
- Joined
- Aug 26, 2005
- Messages
- 165
Hello,
Can anyone tell me the proper syntax to shorten the code below?
In other words:
Any help is greatly appreciated.
Can anyone tell me the proper syntax to shorten the code below?
In other words:
Code:
cell:cell.offset(0,36).Borders.ColorIndex=5
Any help is greatly appreciated.
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
For Each cell In Range("a3:a1000")
If cell <> "" Then
With cell
.Borders.ColorIndex = 5
.Offset(0, 1).Borders.ColorIndex = 5
.Offset(0, 2).Borders.ColorIndex = 5
.Offset(0, 3).Borders.ColorIndex = 5
.Offset(0, 4).Borders.ColorIndex = 5
.Offset(0, 5).Borders.ColorIndex = 5
.Offset(0, 6).Borders.ColorIndex = 5
.Offset(0, 7).Borders.ColorIndex = 5
.Offset(0, 8).Borders.ColorIndex = 5
.Offset(0, 9).Borders.ColorIndex = 5
.Offset(0, 10).Borders.ColorIndex = 5
.Offset(0, 11).Borders.ColorIndex = 5
.Offset(0, 12).Borders.ColorIndex = 5
.Offset(0, 13).Borders.ColorIndex = 5
.Offset(0, 14).Borders.ColorIndex = 5
.Offset(0, 15).Borders.ColorIndex = 5
.Offset(0, 16).Borders.ColorIndex = 5
.Offset(0, 17).Borders.ColorIndex = 5
.Offset(0, 18).Borders.ColorIndex = 5
.Offset(0, 19).Borders.ColorIndex = 5
.Offset(0, 20).Borders.ColorIndex = 5
.Offset(0, 21).Borders.ColorIndex = 5
.Offset(0, 22).Borders.ColorIndex = 5
.Offset(0, 23).Borders.ColorIndex = 5
.Offset(0, 24).Borders.ColorIndex = 5
.Offset(0, 25).Borders.ColorIndex = 5
.Offset(0, 26).Borders.ColorIndex = 5
.Offset(0, 27).Borders.ColorIndex = 5
.Offset(0, 28).Borders.ColorIndex = 5
.Offset(0, 29).Borders.ColorIndex = 5
.Offset(0, 30).Borders.ColorIndex = 5
.Offset(0, 31).Borders.ColorIndex = 5
.Offset(0, 32).Borders.ColorIndex = 5
.Offset(0, 33).Borders.ColorIndex = 5
.Offset(0, 34).Borders.ColorIndex = 5
.Offset(0, 35).Borders.ColorIndex = 5
.Offset(0, 36).Borders.ColorIndex = 5
End With
End If
Next
End Sub