Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default Why isn't this code to change the font colour working?

The following snippet of code is supposed to change the value in the
8th column row the row MatchLineNum to "Yes" and then change the first
22 columns of that row to black font.

With Sheets("Macquarie Commissions")
..Cells(MatchLineNum, 8).Value = "Yes"
..Cells(MatchLineNum, 22).Font.ThemeColor = xlThemeColorLight1
End With

The "Yes" part works fine.
The font colour change on the other hand doesn't do anything at all.
The font colour remains the same as it was before the macro was run.

Why?

Travis
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Why isn't this code to change the font colour working?

How about (not sure why you have .. instead of . either)

..Cells(MatchLineNum, 22).Font.Color = xlThemeColorLight1

I'm not sure what xlThemeColorLight1 is, but you can get the font colors
from here.

http://www.mvps.org/dmcritchie/excel/colors.htm

Scroll to the bottom of the page.
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"travis" wrote:

The following snippet of code is supposed to change the value in the
8th column row the row MatchLineNum to "Yes" and then change the first
22 columns of that row to black font.

With Sheets("Macquarie Commissions")
..Cells(MatchLineNum, 8).Value = "Yes"
..Cells(MatchLineNum, 22).Font.ThemeColor = xlThemeColorLight1
End With

The "Yes" part works fine.
The font colour change on the other hand doesn't do anything at all.
The font colour remains the same as it was before the macro was run.

Why?

Travis

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Why isn't this code to change the font colour working?

Threw me too, Barb. But guess what, it is something in xl2007 developers
guide.
http://msdn.microsoft.com/en-us/library/bb242965.aspx


"Barb Reinhardt" wrote:

How about (not sure why you have .. instead of . either)

.Cells(MatchLineNum, 22).Font.Color = xlThemeColorLight1

I'm not sure what xlThemeColorLight1 is, but you can get the font colors
from here.

http://www.mvps.org/dmcritchie/excel/colors.htm

Scroll to the bottom of the page.
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"travis" wrote:

The following snippet of code is supposed to change the value in the
8th column row the row MatchLineNum to "Yes" and then change the first
22 columns of that row to black font.

With Sheets("Macquarie Commissions")
..Cells(MatchLineNum, 8).Value = "Yes"
..Cells(MatchLineNum, 22).Font.ThemeColor = xlThemeColorLight1
End With

The "Yes" part works fine.
The font colour change on the other hand doesn't do anything at all.
The font colour remains the same as it was before the macro was run.

Why?

Travis

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default Why isn't this code to change the font colour working?

On Oct 18, 7:52*am, Barb Reinhardt
wrote:
How about (not sure why you have .. instead of . either)

.Cells(MatchLineNum, 22).Font.Color = xlThemeColorLight1



Still not working (with that, or any other colour). It simply doesn't
change the font colour at all.

I've searched this newsgroup's past answers and it appears a lot of
people had issues with it. I've managed a workaround by using a
select, copy, paste method instead of changing the .font.color
property, but why doesn't the .font.color property work? Is it just
2007, or earlier versions as well?

Travis
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Why isn't this code to change the font colour working?

don't know, did you try colorindex instead of color?

--


Gary

"travis" wrote in message
...
On Oct 18, 7:52 am, Barb Reinhardt
wrote:
How about (not sure why you have .. instead of . either)

.Cells(MatchLineNum, 22).Font.Color = xlThemeColorLight1



Still not working (with that, or any other colour). It simply doesn't
change the font colour at all.

I've searched this newsgroup's past answers and it appears a lot of
people had issues with it. I've managed a workaround by using a
select, copy, paste method instead of changing the .font.color
property, but why doesn't the .font.color property work? Is it just
2007, or earlier versions as well?

Travis




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default Why isn't this code to change the font colour working?

On Oct 18, 7:34*am, travis wrote:
The following snippet of code is supposed to change the value in the
8th column row the row MatchLineNum to "Yes" and then change the first
22 columns of that row to black font.

With Sheets("Macquarie Commissions")
.Cells(MatchLineNum, 8).Value = "Yes"
.Cells(MatchLineNum, 22).Font.ThemeColor = xlThemeColorLight1
End With



Ugh! I made a dumb noob error! :(

If you look at my description of what I wanted it to do (change the
first 22 columns in the row to black font) and what I actually codes
(change the 22nd cell only), its obvious why it wasn't working!

This worked though:

With Sheets("Macquarie Commissions")
.Cells(MatchLineNum, 8).Value = "Yes"
.Rows(MatchLineNum).Font.ThemeColor = xlThemeColorLight1
End With

Sorry!

Travis
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change font colour Min Excel Discussion (Misc queries) 9 February 18th 10 01:50 AM
Change font colour Stefi Excel Discussion (Misc queries) 1 March 28th 07 01:54 AM
Change Font Colour in VB Q Sean Excel Programming 5 January 16th 07 02:31 AM
Change font colour [email protected] Excel Discussion (Misc queries) 3 December 23rd 06 07:07 PM
Change font colour for whole row Saleee Excel Worksheet Functions 2 October 10th 06 06:41 PM


All times are GMT +1. The time now is 04:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"