+ Reply to Thread
Results 1 to 13 of 13

VB code to change the font to white for selected range

  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    VB code to change the font to white for selected range

    Hello:

    Please refer to attached file.

    i have data range in cell A2 to B14.
    I also have check box in cell C2 to C14.

    I need a VB code to change the font to white for the range in column A AND B if they have corresponding check box
    marked in column C.

    For example :

    If the box in cell C2 and C4 is marked then the corresponding range in column A and B.

    Let me know if you have any questions.
    Thanks.


    Riz
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: VB code to change the font to white for selected range

    You can try something like this :
    Please Login or Register  to view this content.
    Happy Computing ,

    Xlbiznes.

    To show your appreciation please click *

  3. #3
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB code to change the font to white for selected range

    Hello Xlbiznes:

    I am getting error at If Shape(x).

    Please have a look at the attached sheet, update the code and if possible please resend.
    Thanks
    Riz
    Attached Files Attached Files

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,446

    Re: VB code to change the font to white for selected range

    Hi,

    Try
    ActiveSheet.Shapes(x)
    instead of
    Shapes(x).
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  5. #5
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB code to change the font to white for selected range

    Hi Marvin:

    I have tried the code but erroring out the last "Range(Range("b" & x)).Font.Color = vbBlack
    "

    Please Login or Register  to view this content.
    Please refer to attached file.
    Let me know if you have any questions.
    Thanks.
    Riz
    Attached Files Attached Files

  6. #6
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: VB code to change the font to white for selected range

    as an option
    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB code to change the font to white for selected range

    Hi Nilem:

    Thanks a lot but looks like the code is changing the data in Column A and B and making the font white.
    I would like to use the range shown in column A and B.
    Basically if the i have checked boxes in cell c2 and c3 then change the font to white for Data range shown in cell A2, B2,A3 and B3.
    I hope this is clear.
    Please let me know if you have any questions.
    Thanks.

    Riz

  8. #8
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: VB code to change the font to white for selected range

    a-ah, now it seems understood
    Please Login or Register  to view this content.
    Attached Files Attached Files

  9. #9
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB code to change the font to white for selected range

    Hi Nilem:

    Excellent work..work great.
    Can i ask you a favor to help add 1 more check box which will uncheck and check all buttons.
    Thanks a lot for your great time and effort.
    Riz

  10. #10
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: VB code to change the font to white for selected range

    Hi Riz
    try
    Please Login or Register  to view this content.
    Attached Files Attached Files

  11. #11
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB code to change the font to white for selected range

    Hi Nilem:

    Super Smart.
    Works great.
    Now i want to implement the code into my worksheet as the data location is little different.
    In the sample file uploaded earlier, the data we had was in cell A2:C14.
    My actual data will be in cell S106:V118.
    Please help modify the code so that i don't get error.

    Thanks a lot for such a great help.
    Riz
    Last edited by rizmomin; 11-21-2014 at 12:07 PM.

  12. #12
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB code to change the font to white for selected range

    Hi Nilem:

    Below is the code i am using to accomodate my data but it is giving error.
    Please let me know what changes would i need to make to make it work.
    Thanks

    Please Login or Register  to view this content.
    Thanks
    Riz

  13. #13
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB code to change the font to white for selected range

    Hi Nilem:

    Sorry, I got it working.
    Once again thank u so much for all the help.
    Riz

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 06-14-2014, 08:15 PM
  2. VBA code to change font color in range of cells when certain text is entered?
    By BrianG in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 12-21-2012, 06:30 PM
  3. change display font to actual selected font
    By Flannigan in forum Excel General
    Replies: 1
    Last Post: 08-30-2005, 09:05 AM
  4. macro to white out (to change a font in selected cells)
    By Abi in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-03-2005, 05:06 PM

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