Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Setting borders with a macro
Hi
I recorded the below macro to set borders for each cell in a range. I just think this macro could be shorter. I tried a few options buy they didn't work. Could anyone help me to make it shorter. Selection.CurrentRegion.Select With Selection.borders(xlEdgeLeft) .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.borders(xlEdgeTop) .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.borders(xlEdgeBottom) .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.borders(xlEdgeRight) .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.borders(xlInsideVertical) .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.borders(xlInsideHorizontal) .Weight = xlThin .ColorIndex = xlAutomatic End With Thanks, Orquidea |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Setting borders with a macro
You could use just this one line for the whole thing...
Selection.Borders.Weight = xlThin -- HTH... Jim Thomlinson "orquidea" wrote: Hi I recorded the below macro to set borders for each cell in a range. I just think this macro could be shorter. I tried a few options buy they didn't work. Could anyone help me to make it shorter. Selection.CurrentRegion.Select With Selection.borders(xlEdgeLeft) .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.borders(xlEdgeTop) .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.borders(xlEdgeBottom) .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.borders(xlEdgeRight) .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.borders(xlInsideVertical) .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.borders(xlInsideHorizontal) .Weight = xlThin .ColorIndex = xlAutomatic End With Thanks, Orquidea |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Setting borders with a macro
Thanks for your help
"Jim Thomlinson" wrote: You could use just this one line for the whole thing... Selection.Borders.Weight = xlThin -- HTH... Jim Thomlinson "orquidea" wrote: Hi I recorded the below macro to set borders for each cell in a range. I just think this macro could be shorter. I tried a few options buy they didn't work. Could anyone help me to make it shorter. Selection.CurrentRegion.Select With Selection.borders(xlEdgeLeft) .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.borders(xlEdgeTop) .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.borders(xlEdgeBottom) .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.borders(xlEdgeRight) .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.borders(xlInsideVertical) .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.borders(xlInsideHorizontal) .Weight = xlThin .ColorIndex = xlAutomatic End With Thanks, Orquidea |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro not able to run due to a security setting | Excel Discussion (Misc queries) | |||
Setting up Macro to create pie chart. | Charts and Charting in Excel | |||
Setting up a Macro | Excel Worksheet Functions | |||
Setting borders for two rows and all columns on spread sheet | Excel Worksheet Functions | |||
Setting up a macro to print? | Excel Worksheet Functions |