Drawing borders with Macro
Hi Drew,
First a small warning:
A sheet only has 256 columns, so you would not be able to record a full
year.
I have cooked this macro to reset the borders for each week:
Sub NewEndOfWeek()
'
' NewEndOfWeek Macro
' This macro is created by Executor on 19 jan 2005
'
'
Dim lngLastRow As Long
Dim lngLastCol As Long
Dim lngLoopCOls As Long
Dim strLast As String
lngLastRow = Range("A1").SpecialCells(xlCellTypeLastCell).Row
lngLastCol = Range("A1").SpecialCells(xlCellTypeLastCell).Colum n
For lngLoopCOls = 2 To lngLastCol
If IsDate(Cells(1, lngLoopCOls)) Then
If Weekday(Cells(1, lngLoopCOls)) = vbSunday Then
Range(Cells(1, lngLoopCOls), Cells(lngLastRow,
lngLoopCOls)).Select
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
ElseIf Weekday(Cells(1, lngLoopCOls)) = vbWednesday Then
Range(Cells(1, lngLoopCOls), Cells(lngLastRow,
lngLoopCOls)).Select
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
End If
End If
Next
Range("A1").Select
End Sub
Hoop this helps
Executor
|