PC Review


Reply
Thread Tools Rate Thread

condense code for gridelines

 
 
=?Utf-8?B?U0lUQ0ZhblRO?=
Guest
Posts: n/a
 
      30th Jun 2006
Is there a way to shorten this code a bit. I recorded this macro and just
feel there is a way to condense it, I'm just not sure how. All I'm trying to
do is add grid lines to my sheet. This macro formats about 2 dozen pages so
the less code the better. Thanks

Columns("A:H").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
 
Reply With Quote
 
 
 
 
britwiz@hotmail.com
Guest
Posts: n/a
 
      30th Jun 2006

SITCFanTN wrote:
> Is there a way to shorten this code a bit. I recorded this macro and just
> feel there is a way to condense it, I'm just not sure how. All I'm trying to
> do is add grid lines to my sheet. This macro formats about 2 dozen pages so
> the less code the better. Thanks



Hi SITCFanTN

Try:

Columns("A:H").Borders.LineStyle = xlContinuous


Regards

Steve

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Can i condense this code ? or for clarity should it be different ? Albert D. Kallal Microsoft Access VBA Modules 0 1st Mar 2010 06:12 AM
Condense code LiAD Microsoft Excel Programming 2 7th Sep 2009 07:48 AM
Basic code condense question =?Utf-8?B?VEtN?= Microsoft Access VBA Modules 2 12th Jul 2007 06:02 PM
Condense Code =?Utf-8?B?TmlnZWw=?= Microsoft Excel Programming 2 22nd Dec 2005 11:59 PM
Condense VBA Code FrankB Microsoft Excel Misc 3 26th Sep 2003 07:19 AM


Features
 

Advertising
 

Newsgroups
 


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