Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default VBA code for outline border

Excel XP & Win XP
When I record a macro and place an outline border, the recorder of course
lays down a bunch of lines encompassing every facet of the border.
Is there a simple command to produce an outline border? Thanks for your
time. Otto


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default VBA code for outline border

Otto,

I'm assuming you want to create a single border around a range of cells, not
setting the borders for each individual cell in the range. Try

Range("C3:D20").BorderAround Weight:=xlMedium

You could modify this to

Selection.BorderAround Weight:=xlMedium
' or
ActiveCell.BorderAround Weight:=xlMedium

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"Otto Moehrbach" wrote in message
...
Excel XP & Win XP
When I record a macro and place an outline border, the recorder of course
lays down a bunch of lines encompassing every facet of the border.
Is there a simple command to produce an outline border? Thanks for your
time. Otto



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default VBA code for outline border

Otto

To outline each cell in selection.............

Sub Border_Cells()
With Selection
.Borders.LineStyle = xlContinuous
.Borders.Weight = xlThick
.Borders.ColorIndex = xlAutomatic
End With
End Sub

To outline around cells in selection.........

Sub Border_Cells22()
With Selection.Borders
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection
.Borders(xlInsideVertical).LineStyle = xlNone
.Borders(xlInsideHorizontal).LineStyle = xlNone
End With
End Sub


Gord

On Sat, 23 Dec 2006 14:05:51 -0500, "Otto Moehrbach"
wrote:

Excel XP & Win XP
When I record a macro and place an outline border, the recorder of course
lays down a bunch of lines encompassing every facet of the border.
Is there a simple command to produce an outline border? Thanks for your
time. Otto


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default VBA code for outline border

Chip
You're like a gold mine. Thanks for all your help, before as well as
now. Otto
"Chip Pearson" wrote in message
...
Otto,

I'm assuming you want to create a single border around a range of cells,
not setting the borders for each individual cell in the range. Try

Range("C3:D20").BorderAround Weight:=xlMedium

You could modify this to

Selection.BorderAround Weight:=xlMedium
' or
ActiveCell.BorderAround Weight:=xlMedium

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"Otto Moehrbach" wrote in message
...
Excel XP & Win XP
When I record a macro and place an outline border, the recorder of course
lays down a bunch of lines encompassing every facet of the border.
Is there a simple command to produce an outline border? Thanks for your
time. Otto





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default VBA code for outline border

Cool!

Thanks Chip.....never new the BorderAround existed. Found it in help under the
Range Object section.

Do you think I should read the Help section more often? <g


Gord

On Sat, 23 Dec 2006 13:18:12 -0600, "Chip Pearson" wrote:

Otto,

I'm assuming you want to create a single border around a range of cells, not
setting the borders for each individual cell in the range. Try

Range("C3:D20").BorderAround Weight:=xlMedium

You could modify this to

Selection.BorderAround Weight:=xlMedium
' or
ActiveCell.BorderAround Weight:=xlMedium




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default VBA code for outline border

Do you think I should read the Help section more often? <g

Never hurts to read the Help. Actually, I find most of this sort of stuff by
poking around the Object Browser in VBA.

And speaking of Help, I've found the Help in Excel 2007 to be MUCH better
than the Help in previous versions. I've got it configured to search both
online and offline help, and everytime I've used it (mainly to find out
where in the hell they moved a command to), I've found what I'm looking for
on the first try. It seems that MS finally realized that Help was meant to
be used.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)



"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
Cool!

Thanks Chip.....never new the BorderAround existed. Found it in help
under the
Range Object section.

Do you think I should read the Help section more often? <g


Gord

On Sat, 23 Dec 2006 13:18:12 -0600, "Chip Pearson"
wrote:

Otto,

I'm assuming you want to create a single border around a range of cells,
not
setting the borders for each individual cell in the range. Try

Range("C3:D20").BorderAround Weight:=xlMedium

You could modify this to

Selection.BorderAround Weight:=xlMedium
' or
ActiveCell.BorderAround Weight:=xlMedium




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default VBA code for outline border

Thanks Chip.

Not upgraded yet to 2007.

At my age the learning curve is getting steeper so may not bother.


Gord

On Sat, 23 Dec 2006 15:13:05 -0600, "Chip Pearson" wrote:

Do you think I should read the Help section more often? <g


Never hurts to read the Help. Actually, I find most of this sort of stuff by
poking around the Object Browser in VBA.

And speaking of Help, I've found the Help in Excel 2007 to be MUCH better
than the Help in previous versions. I've got it configured to search both
online and offline help, and everytime I've used it (mainly to find out
where in the hell they moved a command to), I've found what I'm looking for
on the first try. It seems that MS finally realized that Help was meant to
be used.


Gord Dibben MS Excel MVP
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shape Outline (border) Neil Pearce Excel Discussion (Misc queries) 1 April 8th 08 12:18 PM
Conditional Format - Outline Border Sam via OfficeKB.com Excel Worksheet Functions 12 May 1st 07 03:04 AM
Conditional Formatting - Frame cells with Outline Border Sam Excel Discussion (Misc queries) 2 June 20th 06 05:38 PM
Conditional Format - Outline Border Drahos Excel Worksheet Functions 2 February 1st 06 09:42 AM
only last cell on page to have bottom border (cell area outline) Wiggum Excel Worksheet Functions 1 April 29th 05 03:53 PM


All times are GMT +1. The time now is 04:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"