Hi,
Does anyone know a good way to tidy-up the following code. I am trying to draw borders around various different ranges, but as I'm doing this on about 15 different ranges the code takes up a lot of space (and probably isn't very efficient). This is a sample of what I have at the moment:
With .Range(Cells(4, "D"), Cells(Counter, "D"))
.Borders(xlEdgeBottom).Weight = xlMedium
.Borders(xlEdgeTop).Weight = xlMedium
.Borders(xlEdgeLeft).Weight = xlMedium
.Borders(xlEdgeRight).Weight = xlMedium
End With
With .Range(Cells(4, "F"), Cells(Counter, "F"))
.Borders(xlEdgeBottom).Weight = xlMedium
.Borders(xlEdgeTop).Weight = xlMedium
.Borders(xlEdgeLeft).Weight = xlMedium
.Borders(xlEdgeRight).Weight = xlMedium
End With
With .Range(Cells(4, "G"), Cells(Counter, "G"))
.Borders(xlEdgeBottom).Weight = xlMedium
.Borders(xlEdgeTop).Weight = xlMedium
.Borders(xlEdgeLeft).Weight = xlMedium
.Borders(xlEdgeRight).Weight = xlMedium
End With
Does anyone know a good way to tidy-up the following code. I am trying to draw borders around various different ranges, but as I'm doing this on about 15 different ranges the code takes up a lot of space (and probably isn't very efficient). This is a sample of what I have at the moment:
With .Range(Cells(4, "D"), Cells(Counter, "D"))
.Borders(xlEdgeBottom).Weight = xlMedium
.Borders(xlEdgeTop).Weight = xlMedium
.Borders(xlEdgeLeft).Weight = xlMedium
.Borders(xlEdgeRight).Weight = xlMedium
End With
With .Range(Cells(4, "F"), Cells(Counter, "F"))
.Borders(xlEdgeBottom).Weight = xlMedium
.Borders(xlEdgeTop).Weight = xlMedium
.Borders(xlEdgeLeft).Weight = xlMedium
.Borders(xlEdgeRight).Weight = xlMedium
End With
With .Range(Cells(4, "G"), Cells(Counter, "G"))
.Borders(xlEdgeBottom).Weight = xlMedium
.Borders(xlEdgeTop).Weight = xlMedium
.Borders(xlEdgeLeft).Weight = xlMedium
.Borders(xlEdgeRight).Weight = xlMedium
End With