Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-28-2014, 11:30 AM
mbesspiata mbesspiata is offline Shorter VBA for creating borders for cells Windows 7 64bit Shorter VBA for creating borders for cells Office 2010 64bit
Advanced Beginner
Shorter VBA for creating borders for cells
 
Join Date: Mar 2011
Location: Virginia
Posts: 57
mbesspiata is on a distinguished road
Default Shorter VBA for creating borders for cells

I am always placing borders around cells in my finished reports and the vba for that is so large. Is there a shorter vba code for doing that. Below is one for just 10 cells.
Range("AG2:AH6").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)


.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With


There must be a shorter/quicker way to do this.

Mike
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shorter VBA for creating borders for cells Creating borders in word joechidwala Word 2 02-05-2014 05:33 AM
Shorter VBA for creating borders for cells How to create shorter docs from large base template? Preloader Word 13 10-19-2013 09:39 PM
Shorter VBA for creating borders for cells Differences in borders at page break in merged cells Sudlav Word Tables 2 05-23-2013 11:50 PM
borders disappear from merged cells when pasting from excel joba Word 0 09-10-2012 11:35 AM
Shorter VBA for creating borders for cells PDF conversion creating borders around text BrazzellMarketing Word 4 01-17-2011 01:09 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:49 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft