+ Reply to Thread
Results 1 to 6 of 6

Changing Cell color?

Hybrid View

  1. #1
    Registered User
    Join Date
    09-22-2008
    Location
    vienna
    MS-Off Ver
    MS Office 2007
    Posts
    24

    Changing Cell color?

    Hi,

    I have a code that check the String on the cell! But if it is wrong i wanna make the cell Red colored?

    If Selection.Cells(x, 14) <> "A" And Selection.Cells(x, 14) <> "B" And Selection.Cells(x, 14) <> "C" And Selection.Cells(x, 14) <> "D" And Selection.Cells(x, 14) <> "L" And Selection.Cells(x, 14) <> "N" And Selection.Cells(x, 14) <> "S" And Selection.Cells(x, 14) <> "T" Then
        MsgBox "Type is False! You have to change it! " & "Place: Selected Row: " & x & " Column: 14 (N)"
        GoTo Einde
        End If
    Thanks
    Last edited by xmux; 03-26-2009 at 06:15 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Changing Cell color?

    Why not use Conditional Formatting?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    09-22-2008
    Location
    vienna
    MS-Off Ver
    MS Office 2007
    Posts
    24

    Re: Changing Cell color?

    Quote Originally Posted by royUK View Post
    Why not use Conditional Formatting?
    What do u mean??

    Anyway i found it!
    ActiveCell.Interior.ColorIndex = 3 (For RED)

  4. #4
    Registered User
    Join Date
    09-22-2008
    Location
    vienna
    MS-Off Ver
    MS Office 2007
    Posts
    24

    Re: Changing Cell color?

    Sorry it is not working like that... I dont want it with the conditional Formatting because people can copy paste on this document.. than the conditional Formatting goes away...

    So i need a macro for it? Anyone has any idea??

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Changing Cell color?

    I can't see why this shouldn't work, it'shard to check without the full code or an example workbook
    If Selection.Cells(x, 14) <> "A" And Selection.Cells(x, 14) <> "B" And _
        Selection.Cells(x, 14) <> "C" And Selection.Cells(x, 14) <> "D" And _
        Selection.Cells(x, 14) <> "L" And Selection.Cells(x, 14) <> "N" And _
        Selection.Cells(x, 14) <> "S" And Selection.Cells(x, 14) <> "T" Then
        MsgBox "Type is False! You have to change it! " & "Place: Selected Row: " & x & " Column: 14 (N)"
        Selection.Cells(x, 14).Interior.ColorIndex = 3
        GoTo Einde
        End If

  6. #6
    Registered User
    Join Date
    09-22-2008
    Location
    vienna
    MS-Off Ver
    MS Office 2007
    Posts
    24

    Re: Changing Cell color?

    yeah exactly i am a little bit stupid today.. Thanks!!

+ 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