+ Reply to Thread
Results 1 to 13 of 13

Command Buttons for Fill Colour and Font Colour

Hybrid View

Gos-C Command Buttons for Fill... 09-19-2010, 06:31 PM
venkat1926 Re: Command Buttons for Fill... 09-19-2010, 10:53 PM
venkat1926 Re: Command Buttons for Fill... 09-20-2010, 06:59 AM
Gos-C Re: Command Buttons for Fill... 09-20-2010, 10:21 AM
Gos-C Re: Command Buttons for Fill... 09-20-2010, 08:05 PM
shg Re: Command Buttons for Fill... 09-20-2010, 08:10 PM
Gos-C Re: Command Buttons for Fill... 09-21-2010, 07:57 AM
romperstomper Re: Command Buttons for Fill... 09-21-2010, 07:59 AM
teylyn Re: Command Buttons for Fill... 09-21-2010, 08:29 AM
Gos-C Re: Command Buttons for Fill... 09-21-2010, 09:29 AM
Gos-C Re: Command Buttons for Fill... 09-22-2010, 08:06 AM
angeleyes Re: Command Buttons for Fill... 07-14-2011, 06:05 AM
romperstomper Re: Command Buttons for Fill... 07-14-2011, 07:11 AM
  1. #1
    Valued Forum Contributor
    Join Date
    06-17-2009
    Location
    Chennai,India
    MS-Off Ver
    Excel 2003,excel 2007
    Posts
    678

    Re: Command Buttons for Fill Colour and Font Colour

    gos-c
    I did a few experiments. see the file "change color gos.xls"

    I placed a command button from the CONTROL TOOLBAR in the cell D1
    i right clicked the button and clicked properties

    name: cmdfillcolor
    caption: fillcolor

    if your right click the sheet tab and click view code you can see this event code

    Dim r As Range
    Private Sub cmdfillcolor_Click()
    Set r = Selection
    
    With cmdfillcolor
    If .Caption = "fill color" Then
    r.EntireRow.Interior.ColorIndex = 6
    .Caption = ""
    Else
    .Caption = "fill color"
    r.EntireRow.Interior.ColorIndex = xlNone
    End If
    End With
    End Sub
    remove design mode

    now select any one cell in each of two or three different rows(as you know if these are adjacent rows you can use "shift" key otherwise control key

    now click the button the rows will be colored with yellow
    again click the color will be removed.

    do this experiment(using command button as toggle button) two or three times.

    now you can modify this button code and also for different buttons you requrie

    does it work to your needs.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    09-19-2004
    Location
    Canada
    Posts
    408

    Re: Command Buttons for Fill Colour and Font Colour

    Hi venkat1926,

    Thanks for your response.

    I would like only the range A:AC of the selection fill - instead of the entire row in the following lines:

    r.EntireRow.Interior.ColorIndex = 6
    r.EntireRow.Interior.ColorIndex = xlNone
    Using Excel 2010 & Windows 10
    "It is better to be prepared for an opportunity and not have one than to have an opportunity and not be prepared."

  3. #3
    Forum Contributor
    Join Date
    09-19-2004
    Location
    Canada
    Posts
    408

    Re: Command Buttons for Fill Colour and Font Colour

    Can you help, anyone?

    Thanks,
    Gos-C

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

    Re: Command Buttons for Fill Colour and Font Colour

    In Excel 2003, you can tear off the Fill Color menu so it sits on the sheet (click the dropdown, and when the toolbar appears, grab the top and drag it onto the sheet. Then you have single-click access to any fill color, or none.
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Forum Contributor
    Join Date
    09-19-2004
    Location
    Canada
    Posts
    408

    Re: Command Buttons for Fill Colour and Font Colour

    Hi Shg,

    I am (we are) using Excel 2007, but I posted the sample spreadsheet in Excel 2003 format in order to accommodate anyone who was not using Excel 2007. Furthermore, I need to use VBA to ensure that everyone who uses the template applies the exact colour because the colour would be used to sum/count in the data.

    I want to work with columns A to AC only - not the entire row,

    Thanks,
    Gos-C

+ 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