Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Add Border to the right side (xlEdgeRight) of a large number of co
So I have a very large report with a ton columns that I would to add a border
on the right edge. Do I need to repeat this code for each column (see below), because the columns go way out to DE and that would see quite cumbersome. ------- Range("A9").Select With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With Range("B9").Select With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With ----- Finally I tried this: Range("A9:D9").Borders(xlEdgeRight).Weight = xlThin ....but that only put the border on D9 and that doesn't work. Thanks! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Add Border to the right side (xlEdgeRight) of a large number of co
When I record a macro while adding interior lines, I get the following:
Columns("A:DE").Select Selection.Borders(xlEdgeLeft).LineStyle = xlNone With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With HTH, Keith "MattyO" wrote in message ... So I have a very large report with a ton columns that I would to add a border on the right edge. Do I need to repeat this code for each column (see below), because the columns go way out to DE and that would see quite cumbersome. ------- Range("A9").Select With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With Range("B9").Select With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With ----- Finally I tried this: Range("A9:D9").Borders(xlEdgeRight).Weight = xlThin ...but that only put the border on D9 and that doesn't work. Thanks! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Add Border to the right side (xlEdgeRight) of a large number o
ker_01
In this case, I only want row 9 for all these columns to do this, not every row in the worksheet. When I change your first line out to Columns("A9:DE9").Select, it doesn't work. "ker_01" wrote: When I record a macro while adding interior lines, I get the following: Columns("A:DE").Select Selection.Borders(xlEdgeLeft).LineStyle = xlNone With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With HTH, Keith "MattyO" wrote in message ... So I have a very large report with a ton columns that I would to add a border on the right edge. Do I need to repeat this code for each column (see below), because the columns go way out to DE and that would see quite cumbersome. ------- Range("A9").Select With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With Range("B9").Select With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With ----- Finally I tried this: Range("A9:D9").Borders(xlEdgeRight).Weight = xlThin ...but that only put the border on D9 and that doesn't work. Thanks! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Add Border to the right side (xlEdgeRight) of a large number o
I was trying to imply that when you record a macro, it will give you a great
headstart on your code (since I interpreted your original post to be asking how to add interior border lines to a range instead of selecting each cell and adding one exterior border at a time). If you are trying to use macro code without any edits, I'm not surprised that it doesn't work 'out of the box' - Excel is funny that way. Again if I were to guess, you probably need to tell it which sheet you want this code to execute on, such as Sheet1.Columns("A9:DE9").Select. However, without knowing what error you got (or what symptoms lead you to say "it doesn't work" it is hard to give definitive advice. HTH, Keith "MattyO" wrote in message ... ker_01 In this case, I only want row 9 for all these columns to do this, not every row in the worksheet. When I change your first line out to Columns("A9:DE9").Select, it doesn't work. "ker_01" wrote: When I record a macro while adding interior lines, I get the following: Columns("A:DE").Select Selection.Borders(xlEdgeLeft).LineStyle = xlNone With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With HTH, Keith "MattyO" wrote in message ... So I have a very large report with a ton columns that I would to add a border on the right edge. Do I need to repeat this code for each column (see below), because the columns go way out to DE and that would see quite cumbersome. ------- Range("A9").Select With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With Range("B9").Select With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With ----- Finally I tried this: Range("A9:D9").Borders(xlEdgeRight).Weight = xlThin ...but that only put the border on D9 and that doesn't work. Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Easy Reading - large number minus small number | New Users to Excel | |||
Insert or add one number at right side to ISBN | Excel Programming | |||
different colour each side of diagonal border | Excel Discussion (Misc queries) | |||
How do I show a surplus number in an entry (on the plus side) | Excel Worksheet Functions | |||
Getting rid of one side a border? | Excel Programming |