Results 1 to 11 of 11

need a command button to change / unchange the colour of specified cells

Threaded View

  1. #1
    Registered User
    Join Date
    12-19-2013
    Location
    Scotland
    MS-Off Ver
    Microsoft Excel for Microsoft 365 64-bit
    Posts
    11

    need a command button to change / unchange the colour of specified cells

    Hi,

    I'm a complete novice with macros so please forgive me in advance!

    Hope someone can help me with the VBA code required.

    Please see the attached file...


    I've assigned a command button to a macro but I cant get it to perform as required.

    What I require the macro to do is this - When the command button is clicked, specified cells change from no fill colour (which should be the state when the excel file is opened) to a yellow fill colour. When I click the command button again, the cells return to no fill colour.

    Does that make sense?

    Below is the code I have. I know its a load of rubbish, but to be honest I haven't a clue what I'm doing!

    Sub Macro1()
    '
    ' Macro1 Macro
    '
    ' Keyboard Shortcut: Ctrl+Shift+A
    '
        Range("B11,B13,B17,D11,D15,D17,D21").Select
        Range("D21").Activate
        With Selection.Interior
            .Pattern = xlSolid
            .PatternColorIndex = xlAutomatic
            .Color = 65535
            .TintAndShade = 0
            .PatternTintAndShade = 0
        End With
    End Sub
    Any help would be much appreciated!

    Best Regards,
    Cal
    Attached Files Attached Files
    Last edited by fingermouse; 01-09-2014 at 05:54 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Chaniging cells font colour after using command button
    By ncaravela in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-17-2013, 04:59 PM
  2. using a command button to change certain cells font colour.
    By ncaravela in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-17-2013, 10:08 AM
  3. [SOLVED] Change Command Button Colour Based on Cell
    By adam.hewitt5 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-08-2012, 09:43 AM
  4. command button that changes colour of selected cells
    By BLRITCHIE in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-22-2008, 07:33 PM
  5. Using a Command Button to colour cells
    By Wibs in forum Excel General
    Replies: 1
    Last Post: 08-24-2006, 05:42 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