Consulting

Results 1 to 4 of 4

Thread: Colours based on drop down

  1. #1

    Colours based on drop down

    Good Afternoon,

    this is a basic request that Im not certain is possible but want to hope it is. Various websites have a dropdown box which changes the colour scheme of the website and I was wondering if I could replicate this in Excel somehow.

    For example I have a basic dashboard that has a black background mainly for impact however some people dont like the black and would prefer a pastel colour say. If i changed the background the fonts etc wouldnt be visable.

    IS there something i could code that if the drop down options were say "Original, Pastel, Printable", that the whole dashboard could change colour?

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    The easiest way to see how it is done is to record a macro. Otherwise, please post a short example file so that we can best help.

  3. #3
    VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Depending on how many colors and Themes you are talking about, use an IF...Then...ElseIF statement or a Select case Statement to assign different values to some variables, then format the cells using those variable's values.

    This may help
    Sub showColorIndexNums()
        Dim i As Long
        Worksheets.Add before:=Sheets(1)
        [A1].Value = "Color"
        [B1].Value = "Index Number"
        ActiveSheet.Name = "ColorIndex"
        For i = 2 To 58
            Range("A" & i).Interior.ColorIndex = i - 2
            Range("B" & i).Value = i - 2
        Next i
        ActiveSheet.[B:B].EntireColumn.AutoFit
    End Sub
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  4. #4
    cant believe i didnt think of a basic macro!!

    however I also like your Idea SamT thanks to you both. Ill have a bit of a play with both ideas and see which one is the better idea. I think i may have the macros fire based on the drop down option.

    if dropdown = "1" then color1,
    etc

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •