Results 1 to 17 of 17

Help changing color of cells on button click

Threaded View

  1. #1
    Registered User
    Join Date
    08-26-2016
    Location
    england
    MS-Off Ver
    ms office
    Posts
    26

    Help changing color of cells on button click

    Hi,

    I am having problems changing the cell color on button click.

    I want the cells to be invisible/white when the file opens but when i click a button for the cell to change color.

    Please see code below


    Private Sub Workbook_Open()
    If ThisWorkbook.Sheets("Quotation Form").Range("A44").Interior.ColorIndex = 15 Then
    MsgBox "i am white"
    Sheets("Quotation Form").Range("A44").Interior.ColorIndex = 2
    Else
    End If
    End Sub
    
    And then on the sheet with the button the following code
    Private Sub CommandButton2_Click()
    If ThisWorkbook.Sheets("Quotation Form").Range("A44").Interior.ColorIndex = 2 Then
    
    ThisWorkbook.Sheets("Quotation Form").Range("A44").Interior.ColorIndex = 15
    Else
    
    End If
    End Sub
    It is giving me a

    run time error 1004

    Application-Defined or object-defined error

    Any ideas or help much appreciated.

    Thanks in advance
    Attached Files Attached Files
    Last edited by LePig; 08-26-2016 at 09:32 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Change the Color of One Command Button with Click of Another
    By Raymundus in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-26-2016, 03:29 PM
  2. [SOLVED] Click oval option button to fill/unfill color, also change border color to match fill
    By Rocky2013 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-07-2015, 08:29 PM
  3. Replies: 3
    Last Post: 08-18-2014, 12:47 PM
  4. [SOLVED] click on a color button and after button click it will color entire row of cell you click
    By swade730 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-11-2014, 06:06 PM
  5. VBA code for changing color of dots upon click not working as it once did
    By jenny1234 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-19-2013, 03:38 PM
  6. [SOLVED] Changing font attributes on click of button
    By stuartadair in forum Excel General
    Replies: 8
    Last Post: 06-07-2012, 07:47 AM
  7. Changing cells color without clicking command button
    By grumpyguppy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-19-2008, 03:22 AM

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