Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Drawing borders with Macro

I am reworking an existing Excel schedule to reflect some administrative
changes. I have done all of the major work, but I made a mistake while
doing it. The schedule has columns for each day, then rows for each
employee. If the employee works, there is a 1 in the cell for the
corresponding day, if not there is an X. Each work week is divided by a
bold border, so that it is easy for the timekeepers to see when the work
week ended. When I initially sectioned out the work weeks, I made the bold
border between Saturday and Sunday, but alas, the work week runs from Wed to
Tue. Now I need to change all of this, and I thought maybe a macro could
help out.

How can I build a macro to draw borders between T and W?

Thanks,
Drew


  #2   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 03:50 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"