+ Reply to Thread
Results 1 to 4 of 4

Change font color of a string that is a variable

  1. #1
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,163

    Change font color of a string that is a variable

    I want to change the font color of a string that is a variable.
    This is my attempt, which generates an "Invalid qualifier" error.
    The "sActual" is invalid. (Probably because its a string).

    Please Login or Register  to view this content.
    I was able to change the font color via, Sh4Cell.Font.Color = "value", but that did not allow the attribute to stay with the value stored in sActual.

    How can I set the font attribute and maintain that attribute as I paste the value (sActual) in other areas of the workbook?

    Macro sample:
    Please Login or Register  to view this content.
    Any hints, tips or examples are appreciated.
    Last edited by Rick_Stanich; 11-22-2011 at 08:54 AM.
    Regards

    Rick
    Win10, Office 365

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,691

    Re: Change font color of a string that is a variable

    Only text in a cell can have an associated font color attribute. A really simple way to do this is to use a cell to store the value of sActual, instead of a String variable. Instead of declaring sActual as a String, declare it as a range, then assign it some cell. The cell could even be on a hidden worksheet. In my example, I assume a new worksheet called Scratch.

    Please Login or Register  to view this content.
    Then I think the rest of your code will work as is.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,163

    Re: Change font color of a string that is a variable

    I will give this a try in the morning.
    Thank you.

  4. #4
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,163

    Re: Change font color of a string that is a variable


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1