Changing table border color

G

Guest

I am working in excel 2003. I have various sheets with a number of tables in
each one. I need to change the color of the table borders without doing
anything to the border style. When I try using the Format/Cells option, and
then in the borders tab, I can see the table lines divided with a gray
(generic) style because my selection has different types of styles. When I
change the color, it will not apply the changes because I don't click on the
grayed borders (if I did, it would reset my styles, which is an undesired
effect)

I don't really want to use macros (because I think this should be an easy
task for excel). Gee, I wish I had used styles before starting to design the
worksheet.

Thanks!
 
F

Franz

I am working in excel 2003. I have various sheets with a number of
tables in each one. I need to change the color of the table borders
without doing anything to the border style. When I try using the
Format/Cells option, and then in the borders tab, I can see the table
lines divided with a gray (generic) style because my selection has
different types of styles. When I change the color, it will not apply
the changes because I don't click on the grayed borders (if I did, it
would reset my styles, which is an undesired effect)

I don't really want to use macros (because I think this should be an
easy task for excel). Gee, I wish I had used styles before starting
to design the worksheet.

If I have well understood, all tou have to do is to select your table, then
from Format/Cell option select the borders tab, select the style and the
color of the line to apply and *then* click on each side of the rectangle
that represent your table.


--
Hoping to be helpful...

Regards

Franz
 
G

Guest

I know I said I didn't want to use macros, but here it is:

Sub changetoblue()
Dim r As Range
Dim o As Border
Application.ScreenUpdating = False
For Each r In Selection
For Each o In r.Borders
If o.LineStyle <> xlNone Then
o.Color = RGB(0, 0, 255)
End If
Next o
Next
Application.ScreenUpdating = True
End Sub


As you can see, the macro only changes the border if it exists, but it will
not modify the current border style.

I know that I am doing twice the work needed here because each border gets
checked two times, but as I said, it was only because I really needed to do
this.

Thanks anyways Franz.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top