+ Reply to Thread
Results 1 to 2 of 2

Passing Back Color to Interior Color

  1. #1
    ExcelMonkey
    Guest

    Passing Back Color to Interior Color

    I have a routine that passes the back colour of a button
    to the interior colour of a range called Comrng. The
    colour the button takes on is based on a routine. When
    the button is coloured(by routine), the routine works
    fine. However, when I have it set up using its default
    grey (&H8000000F&) colour, teh Comrng takes the valu of 0
    and diplays a black interior color.

    When it is woking, the immediate window shows:
    ?CellComColBtn.BackColor
    16764057
    ?Comrng.Offset(-1, 0).Interior.Color
    16764057
    When its not it shows:
    ?CellComColBtn.BackColor
    -2147483633
    ?Comrng.Offset(-1, 0).Interior.Color
    0

    What is going on here?????

    If ComChkBx = True Then
    Set Comrng = .Worksheets(AuditShtName).Range
    (PasteStartCell).Offset(0, ChkbxArray(0, 1) * 2 - 2)
    Comrng.Offset(-1, 0) = "Cell Comments"
    Comrng.Offset(-1, 0).Interior.Color =
    CellComColBtn.BackColor
    End If

  2. #2
    Tom Ogilvy
    Guest

    Re: Passing Back Color to Interior Color

    That's because your working with apples and oranges.

    The default gray color of the button is only gray because those are your
    windows settings. the number (&H8000000F&) is not an RGB color - it is a
    code designating the button should take on the system color defined for
    Button Face. If you go to the desktop, select properties and assign a
    different color for button face, then show your form, it should take on this
    new color, but still have the value (&H8000000F&) . You can set a button
    to a specific color using RGB. Then it would return the RGB in that case
    (the 16764057 in your example)

    the cells are using RGB colors, so when you feed this value to it, it
    converts it to an RGB color.

    the max RGB color is:
    ? &HFFFFFF
    16777215
    your color number is bigger than that, so you can use an if test to
    determine that the value is or isn't and RGB color value and adjust from
    there.

    You can see this by going into the properties window of the button and
    looking at the backcolor property. the initial choices are system colors
    (on the system tab). You can select the palette tab and assign an RGB
    color.

    --
    Regards,
    Tom Ogilvy


    "ExcelMonkey" <[email protected]> wrote in message
    news:[email protected]...
    > I have a routine that passes the back colour of a button
    > to the interior colour of a range called Comrng. The
    > colour the button takes on is based on a routine. When
    > the button is coloured(by routine), the routine works
    > fine. However, when I have it set up using its default
    > grey (&H8000000F&) colour, teh Comrng takes the valu of 0
    > and diplays a black interior color.
    >
    > When it is woking, the immediate window shows:
    > ?CellComColBtn.BackColor
    > 16764057
    > ?Comrng.Offset(-1, 0).Interior.Color
    > 16764057
    > When its not it shows:
    > ?CellComColBtn.BackColor
    > -2147483633
    > ?Comrng.Offset(-1, 0).Interior.Color
    > 0
    >
    > What is going on here?????
    >
    > If ComChkBx = True Then
    > Set Comrng = .Worksheets(AuditShtName).Range
    > (PasteStartCell).Offset(0, ChkbxArray(0, 1) * 2 - 2)
    > Comrng.Offset(-1, 0) = "Cell Comments"
    > Comrng.Offset(-1, 0).Interior.Color =
    > CellComColBtn.BackColor
    > End If




+ 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