+ Reply to Thread
Results 1 to 7 of 7

Code to change color of text box

  1. #1
    Forum Contributor
    Join Date
    09-16-2013
    Location
    Los Angeles, USA
    MS-Off Ver
    Excel 2011
    Posts
    620

    Code to change color of text box

    Im trying to change the color of a text box on a sheet using a macro. The following code is creating a runtime error 424:
    Please Login or Register  to view this content.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Code to change color of text box

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    09-16-2013
    Location
    Los Angeles, USA
    MS-Off Ver
    Excel 2011
    Posts
    620

    Re: Code to change color of text box

    Produces the same error.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Code to change color of text box

    Please Login or Register  to view this content.
    ... where Sheet1 is the sheet name in the first line and the codename in the second.

  5. #5
    Forum Contributor
    Join Date
    09-16-2013
    Location
    Los Angeles, USA
    MS-Off Ver
    Excel 2011
    Posts
    620

    Re: Code to change color of text box

    The top one returned this error: Unable to get OLEObjects property of the worksheet

    and the bottom one returned the error: Run time Error, Object Required

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Code to change color of text box

    They both work fine here.

    It must be an ActiveX textbox, you must use the correct name, it must be on a worksheet, the sheet name has to be correct for the first line to work, and the codename has to be correct for the second line to work.

  7. #7
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,912

    Re: Code to change color of text box

    Works fine for me.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

+ 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. [SOLVED] vba code to change the cell color by looking in a range that contains the color index valu
    By ckklconner in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-24-2013, 09:15 AM
  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. Code to change cell text color when macro has been applied?
    By XxCMoneyxX in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-30-2012, 01:04 PM
  4. Replies: 0
    Last Post: 09-26-2012, 01:08 PM
  5. change text color based on background color
    By great.bean in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-05-2009, 07:07 PM
  6. [SOLVED] Change of text or background color doesn't change on the screen.
    By Susan in forum Excel General
    Replies: 5
    Last Post: 07-29-2005, 03:05 PM
  7. change text color based on adjacent cell text color
    By matthewst in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-01-2005, 03:49 PM
  8. [SOLVED] How to code so cells or text automatically change color based on .
    By lisamariehewson in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-25-2005, 07: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