![]() |
Declaring an array variable
Hi Bill,
Not sure the following is what you are looking for. Because you said you want the borders on several ranges I have included code demonstrating the use of Union for formatting multiple ranges. Note that the space and underscore at the end of a line is a line break in an otherwise single line of code. Sub BorderApplication() Dim X As Variant Dim N As Integer X = Array(xlEdgeLeft, _ xlEdgeRight, _ xlEdgeTop, _ xlEdgeBottom, _ xlInsideVertical, _ xlInsideHorizontal) Dim rngBorders As Range Set rngBorders = Union(Range("A1:C10"), _ Range("E1:F10"), _ Range("H1:J10")) For N = 0 To 5 With rngBorders.Borders(X(N)) .LineStyle = xlContinuous .ColorIndex = 0 .Weight = xlThin End With Next N End Sub -- Regards, OssieMac |
All times are GMT +1. The time now is 11:26 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com