+ Reply to Thread
Results 1 to 2 of 2

Using a Command Button to colour cells

  1. #1
    Registered User
    Join Date
    11-20-2005
    Posts
    33

    Using a Command Button to colour cells

    Hi,

    I have a huge family tree in Excel, and what I would like to do is to put a Command Button on the worksheet, labelled 'John Blanshard's Will' (I can do that bit!), and when it is clicked all the legatees in his will light up, in light orange, for example.

    So how do I make the Command Button, when clicked, change the colour of, A2:B3 and E2:F4, to Yellow, for example?

    Many thanks

    Wibs

  2. #2
    Registered User
    Join Date
    11-20-2005
    Posts
    33
    Quote Originally Posted by Wibs
    Hi,

    I have a huge family tree in Excel, and what I would like to do is to put a Command Button on the worksheet, labelled 'John Blanshard's Will' (I can do that bit!), and when it is clicked all the legatees in his will light up, in light orange, for example.

    So how do I make the Command Button, when clicked, change the colour of, A2:B3 and E2:F4, to Yellow, for example?

    Many thanks

    Wibs
    Easy peasy.

    Use this code for the Command Button's Click Event:

    Range("A2:B3,E2:F4").Select
    With Selection.Interior
    .ColorIndex = 40
    .Pattern = xlSolid
    End With

    Found it myself folks, I just started the Record Macro, selected and coloured the cells I wanted, stopped the Recorder, then examined the Macro.

    So sweeter when you find it yourself.

    Regards to all,

    Wibs

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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