Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Record a macro will not edit composite drawing object Walter Briscoe New Users to Excel 4 January 12th 09 10:49 PM
Using a macro to add borders Colin Foster[_3_] Excel Programming 1 October 19th 04 07:14 PM
problem when drawing textboxes in excel using macro Chris Lannoo Excel Programming 0 June 23rd 04 12:55 PM
Macro for LOTO Drawing! alainB[_5_] Excel Programming 5 April 19th 04 10:14 PM
Selecting drawing objects or shapes in a macro John DeFiore Excel Programming 3 October 13th 03 02:26 PM


All times are GMT +1. The time now is 11:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"