Results 1 to 6 of 6

Check Background color of cell and write appropriate value in adjacent cell

Threaded View

AnirudhC Check Background color of... 04-28-2017, 04:07 PM
AnirudhC Re: Check Background color of... 04-28-2017, 04:08 PM
Sintek Re: Check Background color of... 04-28-2017, 04:13 PM
AnirudhC Re: Check Background color of... 04-28-2017, 04:37 PM
AnirudhC Re: Check Background color of... 04-28-2017, 04:38 PM
Sintek Re: Check Background color of... 04-28-2017, 04:39 PM
  1. #1
    Registered User
    Join Date
    03-02-2017
    Location
    India
    MS-Off Ver
    2016
    Posts
    24

    Check Background color of cell and write appropriate value in adjacent cell

    Hi all,

    So, I want the macro to check the background color in Column A jump to the next cell in Column B and write whatever Value is assigned to it..
    so if the background color is yellow i want the next column to say "Bi-monthly" etc.
    You can find the other colors and their value in the top part of the attached file

    I have tried my level best but I don't have exact color.index value for most of the colors so I was trying to use RGB as a reference but failing at that too..

    here is the code so far:

    Sub ani()
        Application.ScreenUpdating = False
        
        Dim LR As Long, I As Integer
        I = 1
        LR = Range("A" & Rows.Count).End(xlUp).Row
        Do While I < LR
            If Cells(I, 1).Interior.ColorIndex = 6 Then
                Cells(I, 1).Select
                Cells(I, 1).Offset(0, 1).Select
                ActiveCell.FormulaR1C1 = "Bi-Monthly"
            End If
            If Cells(I, 1).Interior.ColorIndex = 6 Then
                Cells(I, 1).Select
                Cells(I, 1).Offset(0, 1).Select
                ActiveCell.FormulaR1C1 = "Monthly"
            End If
            If Cells(I, 1).Interior.ColorIndex = 6 Then
                Cells(I, 1).Select
                Cells(I, 1).Offset(0, 1).Select
                ActiveCell.FormulaR1C1 = "Weekly"
            End If
            If Cells(I, 1).Interior.ColorIndex = 5 Then
                Cells(I, 1).Select
                Cells(I, 1).Offset(0, 1).Select
                ActiveCell.FormulaR1C1 = "Registration Fee"
            End If
            If Cells(I, 1).Interior.ColorIndex = 6 Then
                Cells(I, 1).Select
                Cells(I, 1).Offset(0, 1).Select
                ActiveCell.FormulaR1C1 = "Miscellaneous Charge"
            End If
            I = I + 1
        Loop
        
    End Sub
    Attached Files Attached Files
    Last edited by AnirudhC; 04-28-2017 at 06:06 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 8
    Last Post: 04-02-2016, 04:00 AM
  2. Replies: 2
    Last Post: 01-05-2016, 06:36 PM
  3. Swapping cell content to INCLUDE CELL FORMATTING (Text color, background color, etc)
    By jcpeterson in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-10-2014, 10:09 AM
  4. Change a Range's cell background color to that of another cell's cond. format color
    By kamelkid2 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-31-2014, 12:57 PM
  5. Change cell background color based on another cells background color
    By Queo in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 4
    Last Post: 06-10-2014, 05:28 AM
  6. Replies: 4
    Last Post: 12-29-2013, 11:41 PM
  7. Add a background color to a cell depending on what you write
    By ady_alternative in forum Excel General
    Replies: 2
    Last Post: 02-17-2010, 09:04 AM

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