ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   formula for selecting all cells (https://www.excelbanter.com/excel-discussion-misc-queries/57255-formula-selecting-all-cells.html)

Andre

formula for selecting all cells
 
I'm trying to create a macro that will select all my cells from the beginning
(top left) to the last one (bottom right corner) and then put a border around
them. Any help is appreciated.

JE McGimpsey

formula for selecting all cells
 
one way:

Dim vSides As Variant
Dim i As Long
vSides = Array(xlEdgeTop, xlEdgeBottom, xlEdgeLeft, xlEdgeRight)
With ActiveSheet.UsedRange.Borders
For i = 0 To UBound(vSides)
With .Item(vSides(i))
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Next i
End With


In article ,
"Andre" wrote:

I'm trying to create a macro that will select all my cells from the beginning
(top left) to the last one (bottom right corner) and then put a border around
them. Any help is appreciated.



All times are GMT +1. The time now is 09:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com