Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
BORDERS
I have spreadsheets which vary in number of rows. I want to put a
border around all the records in column b starting at row 2 and to the bottom of the sheet. Then I want to put another border around column c through column o also starting at row 2. The columns will not ever change just the number of rows. Thanks for the help, |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
BORDERS
This will handle columns C-O on one sheet. I leave the rest to you.
Hth, Merjet Sub DoBorders() Dim rng As Range Dim c As Range Dim iEnd As Long iEnd = Sheets("Sheet1").Range("C65536").End(xlUp).Row 'clear any borders in range Set rng = Sheets("Sheet1").Range("C2:O" & iEnd) For Each c In rng c.Borders(xlEdgeTop).LineStyle = xlNone c.Borders(xlEdgeLeft).LineStyle = xlNone c.Borders(xlEdgeRight).LineStyle = xlNone c.Borders(xlEdgeBottom).LineStyle = xlNone Next c 'add left borders Set rng = Sheets("Sheet1").Range("C2:C" & iEnd) For Each c In rng c.Borders(xlEdgeLeft).LineStyle = xlContinuous c.Borders(xlEdgeLeft).Weight = xlThick Next c 'add bottom borders Set rng = Sheets("Sheet1").Range("C" & iEnd & ":" & "O" & iEnd) For Each c In rng c.Borders(xlEdgeBottom).LineStyle = xlContinuous c.Borders(xlEdgeBottom).Weight = xlThick Next c 'add right borders Set rng = Sheets("Sheet1").Range("O2:O" & iEnd) For Each c In rng c.Borders(xlEdgeRight).LineStyle = xlContinuous c.Borders(xlEdgeRight).Weight = xlThick Next c End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Borders | Excel Discussion (Misc queries) | |||
borders | Excel Discussion (Misc queries) | |||
borders | Excel Discussion (Misc queries) | |||
Borders | Excel Discussion (Misc queries) | |||
Borders | Excel Discussion (Misc queries) |