Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Excel conditional coding

  1. #1
    Guest

    Default

    I am trying to use VB coding to change the cell shading based upon text data, entered into cells, in a workbook, for the active sheet. There are 6 conditions.

    If somebody has some generic code you can e-mail it to trw2264@hotmail.com

    Thanks for any help!

  2. #2
    Board Regular
    Join Date
    Feb 2002
    Location
    Perth Australia
    Posts
    1,584
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi

    You could try an event macro something like this:

    Right click your sheet tab, left click View Code, then paste in this code. Alt+F11 returns you to your sheet.
    Private Sub Worksheet_Change(ByVal Target As Range)

    If Target.Value = "text1" Then Target.Interior.ColorIndex = 3
    If Target.Value = "text2" Then Target.Interior.ColorIndex = 4
    If Target.Value = "text3" Then Target.Interior.ColorIndex = 5
    If Target.Value = "text4" Then Target.Interior.ColorIndex = 6
    If Target.Value = "text5" Then Target.Interior.ColorIndex = 7
    If Target.Value = "text6" Then Target.Interior.ColorIndex = 8
    End Sub

    Change "text1" etc to your text that you want to trigger cell colouring.

    Hope this helps
    regards
    Derek

  3. #3
    Guest

    Default

    Thany you very much for your help! I will try it out!

    Tom

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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