Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / April 2008

Tip: Looking for answers? Try searching our database.

Macro changes color

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Klemen25 - 15 Apr 2008 14:23 GMT
Hello
I have the following macro to set chart fonts to arial 10.
But If I apply this macro to a chart that already has fonts colored
differently (lets say some are red, some blue, some white) it changes
all fonts to black. I tried to remove ColorIndex hoping i would than
ignore color, but it doesn't help. How to make macro that will not
change the set colors in the chart?

Selection.AutoScaleFont = False
   With Selection.Font
       .Name = "Arial"
       .Size = 10
       .Strikethrough = False
       .Superscript = False
       .Subscript = False
       .OutlineFont = False
       .Shadow = False
       .Underline = xlUnderlineStyleNone
       .ColorIndex = xlAutomatic
       .Background = xlAutomatic
   End With
Don Guillett - 15 Apr 2008 15:15 GMT
Try JUST this (untested)
sub chgfont()
With Selection.Font
       .Name = "Arial"
       .Size = 10
end with
end sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@austin.rr.com
> Hello
> I have the following macro to set chart fonts to arial 10.
[quoted text clipped - 17 lines]
>        .Background = xlAutomatic
>    End With
Klemen25 - 15 Apr 2008 18:57 GMT
No, this doesnt work- it does work in cells, but with chart data
labels it changes them to Arial, 10, black.
Sorry- I didnt mention before that this problem accures with data
labels? But now I tested and it changes also fonts in x or y axis from
colored to black if this macro is used.
Dave - 15 Apr 2008 19:48 GMT
Hi,
I suggest that you read the current ColorIndex first.
Insert this as your 2nd line of code:
A = Selection.Font.ColorIndex
Then change the 3rd to last line, .ColorIndex = A
Regards - Dave.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.