ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Shorter method to "box" some cells (https://www.excelbanter.com/excel-programming/331044-shorter-method-box-some-cells.html)

quartz[_2_]

Shorter method to "box" some cells
 
I am using Office 2003 on Windows XP.

I simply want to draw a box around a single cluster of cells, but I find,
using the recorder that you have to use at least four lines of code to do
this:

Selection.Borders(xlEdgeLeft).Weight = xlThin
Selection.Borders(xlEdgeRight).Weight = xlThin
Selection.Borders(xlEdgeBottom).Weight = xlThin
Selection.Borders(xlEdgeTop).Weight = xlThin

Isn't there a one line method that is easier/faster (something like xlBox)?
Thanks in advance for your assistance.

Jim Thomlinson[_4_]

Shorter method to "box" some cells
 
Try this...

selection.borderaround xlthin
--
HTH...

Jim Thomlinson


"quartz" wrote:

I am using Office 2003 on Windows XP.

I simply want to draw a box around a single cluster of cells, but I find,
using the recorder that you have to use at least four lines of code to do
this:

Selection.Borders(xlEdgeLeft).Weight = xlThin
Selection.Borders(xlEdgeRight).Weight = xlThin
Selection.Borders(xlEdgeBottom).Weight = xlThin
Selection.Borders(xlEdgeTop).Weight = xlThin

Isn't there a one line method that is easier/faster (something like xlBox)?
Thanks in advance for your assistance.


Jim Thomlinson[_4_]

Shorter method to "box" some cells
 
In my first post you probalby get the wrong kind of line. Weith is the second
argument so just add a comma

selection.borderaround , xlthin
--
HTH...

Jim Thomlinson


"quartz" wrote:

I am using Office 2003 on Windows XP.

I simply want to draw a box around a single cluster of cells, but I find,
using the recorder that you have to use at least four lines of code to do
this:

Selection.Borders(xlEdgeLeft).Weight = xlThin
Selection.Borders(xlEdgeRight).Weight = xlThin
Selection.Borders(xlEdgeBottom).Weight = xlThin
Selection.Borders(xlEdgeTop).Weight = xlThin

Isn't there a one line method that is easier/faster (something like xlBox)?
Thanks in advance for your assistance.


quartz[_2_]

Shorter method to "box" some cells
 
Exactly what I was looking for, thanks...

"Jim Thomlinson" wrote:

In my first post you probalby get the wrong kind of line. Weith is the second
argument so just add a comma

selection.borderaround , xlthin
--
HTH...

Jim Thomlinson


"quartz" wrote:

I am using Office 2003 on Windows XP.

I simply want to draw a box around a single cluster of cells, but I find,
using the recorder that you have to use at least four lines of code to do
this:

Selection.Borders(xlEdgeLeft).Weight = xlThin
Selection.Borders(xlEdgeRight).Weight = xlThin
Selection.Borders(xlEdgeBottom).Weight = xlThin
Selection.Borders(xlEdgeTop).Weight = xlThin

Isn't there a one line method that is easier/faster (something like xlBox)?
Thanks in advance for your assistance.



All times are GMT +1. The time now is 12:35 AM.

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