logo elektroda
logo elektroda
X
logo elektroda

Creating a Pick List in Excel 2003 with 5 Data Options and Corresponding Cell Fill Colors

kotletti 11835 11
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 10788419
    kotletti
    Level 9  
    Hello and sorry in advance that I am writing without Polish characters, I am in Singapore and the system does not allow me to use Polish characters :(

    The problem I have with Excel is as follows:
    I am trying to create a selection list so that after selecting the data, the cell in which the data is to be inserted should also change the color of the filling.
    The pick-list consists of 5 data and 5 different fill colors to make the document more readable.
    I tried to use the conditional formating option but this option only meets the conditions of 3 parameters :(

    Can I do this using this function or is there any other solution? If so, please help.

    Regards

    Capital letters, commas (and more) are not "Polish characters" - get your post in order. [M]
  • ADVERTISEMENT
  • #2 10789264
    marek003
    Level 40  
    Can you insert (attach) some simple example because I don't quite understand the problem (let's say I understand half of it)?

    Do you definitely allow a solution with a macro?
  • ADVERTISEMENT
  • #3 10789315
    Anonymous
    Anonymous  
  • ADVERTISEMENT
  • #4 10791786
    kotletti
    Level 9  
    ok i will try to insert jpg maybe then it will be easier to explain

    https://obrazki.elektroda.pl/5089786700_1334362784.jpg

    as you can see, I have defined colors for 5 parameters so that they are more visible in the sheet
    the problem is that when adding new cells in the same column, using the selection list, the data from a to e were inserted, but together with the fill color
    when it comes to macros I should be able to handle it with somebody's help
    Best regards and thank you in advance for your help
  • #5 10793300
    walek33
    Level 29  
    As long as I have enough memory, it does not mislead me :D is called in Excel Conditional Formatting . Put in the same for all cells in the column and after the pain.
  • #6 10793316
    kotletti
    Level 9  
    from what I know, conditional formatting in excel 2003 is only for 3 parameters a, b, c and in my case there are 5 :(
  • #7 10793413
    walek33
    Level 29  
    So there is nothing left for you to do but write your conditional formatting support for certain sheet cells. Put it in the event Worksheet_SelectionChange
  • #8 10799179
    kotletti
    Level 9  
    Can you tell me how to do it because it's probably beyond my strength !!!
  • ADVERTISEMENT
  • #9 10800116
    marek003
    Level 40  
    Sorry to veto, I would suggest in the section Worksheet_Change

    Private Sub Worksheet_Change(ByVal Target As Range)
    
    kod_war = Target.Value
    Select Case kod_war
     Case "a": Target.Interior.ColorIndex = 6
     Case "b": Target.Interior.ColorIndex = 4
     Case "c": Target.Interior.ColorIndex = 45
     Case "d": Target.Interior.ColorIndex = 33
     Case "e": Target.Interior.ColorIndex = 7
     Case Else: Target.Interior.ColorIndex = 0
    End Select
    
    End Sub


    in Alt + F11 sheets
    In the project with the name of your file, you click on the sheet you are interested in, e.g. Sheet1
    and paste the above code there
  • #10 10800141
    walek33
    Level 29  
    And very beautiful. You can see that a professional wrote. You were faster. :D
    I would suggest just for embellishments:
    Code: text
    Log in, to see the code

    Works the same and looks better. And it has one more great advantage that I don't dare to mention. :D
  • #11 10800256
    marek003
    Level 40  
    I agree as much as possible :)

    Alternatively, I would throw the line:
    Case "": .ColorIndex = 0
    because it actually meets Else (which I checked empirically :) )

    but I support the amendment with both paws :)
  • #12 10803004
    kotletti
    Level 9  
    You are great, thank you so much for your help !!!

Topic summary

The discussion revolves around creating a pick list in Excel 2003 that allows users to select from five data options, each corresponding to a specific cell fill color. The original poster seeks a solution to apply conditional formatting for five parameters, noting that Excel 2003's built-in conditional formatting supports only three conditions. Various responses suggest using macros to achieve the desired functionality. A specific macro code is provided to change the cell's fill color based on the selected value from the pick list. The conversation includes suggestions for improving the macro's structure and efficiency.
Summary generated by the language model.
ADVERTISEMENT