+ Reply to Thread
Results 1 to 3 of 3

CommandButton1.Backcolor = Number, Getting / Run time error "424" Object Required

  1. #1
    Registered User
    Join Date
    10-05-2013
    Location
    Oregon, USA
    MS-Off Ver
    Excel 2016
    Posts
    2

    Question CommandButton1.Backcolor = Number, Getting / Run time error "424" Object Required

    Hello, I'm moderately new to Macros and have been doing well but for some reason I'm just not getting this. I have Windows Excel 2016, I have a large Macro program but for simplicity I have made a simple Module to figure it out.
    The end result is that I want an "Active X" Button that will change it's background color and Alter Text message when a cell on another worksheet changes it's value (either 0 or 5). I have tried several different options but this is what I have presently for the BackColor.
    Any help would be appreciated. This is what I have below... It returns "Run-time error "428", Object doesn't support this property or method

    Option Explicit
    Sub CommandButton16()

    If Worksheets("Data").Range("I2").Value = 5 Then
    Sheets("Month").CommandButton1.BackColor = 52582
    Else
    Sheets("Month").CommandButton1.BackColor = RGB(224, 224, 224)
    End If

    End Sub

  2. #2
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Re: CommandButton1.Backcolor = Number, Getting / Run time error "424" Object Required

    Welcome to forums.

    Please note that your post does break a rule and your code should be placed within code tags when asking for help.

    But that said... your code does work if when you run it. But I think you are trying to have this change automatically when you change the value in cell I2. So you do not want to use your code in a standard module, but rather have your code in a worksheet.

    So place this code in your "Data" worksheet module.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-05-2013
    Location
    Oregon, USA
    MS-Off Ver
    Excel 2016
    Posts
    2

    Solved

    Hello ptmuldoon,
    Yes, that worked but I really needed it to be in the WorkSheet due to I have 15 WorkSheets that this button is within and Three of the buttons are independent from the others. What I have come up with is that I have it working within each sheet OK. I have also created a "Sub Button#_Click" so when I change the option by clicking on it, it will change the option in my "Sheet("DATA").Range("B1")" so the other "months" sheets will have the same options. It is working but for some reason when I run the code below, The "Sheets("DATA), Range("B1") comes back as an error (Run-time error "1004", saying the DATA cell I am trying to change is protected???
    I have the statement "ActiveSheet.UnProtect" plus I have made the Sheet("DATA") itself Un-Protected and it still comes back with the same error? I don't understand why I'm getting the error and you help?
    I also wanted to thank you for your previous help, though it didn't answer my actual situation, it did set me on the right path to figure out what I needed to do.


    Please Login or Register  to view this content.
    Last edited by Harvey3; 12-20-2019 at 09:24 PM. Reason: SOLVED

+ 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. "Object required" error upon "Exit Function" statement
    By 6StringJazzer in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-24-2018, 06:40 PM
  2. [SOLVED] "ActiveWorkbook.Path" fails - triggers "Compile Error Object required"
    By Ochimus in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-15-2018, 02:58 PM
  3. [SOLVED] Run-Time Error "424" - Object Required
    By zanshin777 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-10-2015, 04:54 PM
  4. UserForm "run time Error 424 Object Required"
    By bimo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-10-2014, 07:47 AM
  5. [SOLVED] Macro generates the following error: "run-time error 424 object required"
    By Metrazal in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-23-2014, 06:31 PM
  6. Run-time error "424": Object required
    By TGM™ in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-29-2012, 05:57 AM
  7. [SOLVED] Excel 2007 : Help to Solve Run-time Error 424 "Object Required"
    By D.S.Rama Rao in forum Excel General
    Replies: 6
    Last Post: 03-05-2012, 03:24 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