![]() |
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, |
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 |
All times are GMT +1. The time now is 03:51 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com