#1
|
|||
|
|||
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 |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Creating borders in word | joechidwala | Word | 2 | 02-05-2014 05:33 AM |
How to create shorter docs from large base template? | Preloader | Word | 13 | 10-19-2013 09:39 PM |
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 |
PDF conversion creating borders around text | BrazzellMarketing | Word | 4 | 01-17-2011 01:09 PM |