+ Reply to Thread
Results 1 to 5 of 5

If statements or conditional formatting

  1. #1
    Forum Contributor
    Join Date
    10-09-2010
    Location
    London
    MS-Off Ver
    Excel Version Office 365
    Posts
    211

    If statements or conditional formatting

    Dear Community.

    i am not sure if this can be done easily.

    In column A I would like to enter either 1, 2 or 3 based on

    If a cell in column B is green then the corresponding row column A will be 1

    If a cell in column C is green then the corresponding row in column A will be 2

    If a cell in column D is green then the corresponding row in column A will be 3

    I have manually highlighted the green.

    Please let me know if it can be done and how?

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: If statements or conditional formatting

    You have manually highlighted the green.

    Will you always do this, or will you use a Conditional Formatting for this?
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Forum Contributor
    Join Date
    10-09-2010
    Location
    London
    MS-Off Ver
    Excel Version Office 365
    Posts
    211

    Re: If statements or conditional formatting

    The green will be entered manually.

  4. #4
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: If statements or conditional formatting

    So, you can not do it using Formulas.

    Maybe using VBA and i have no idea about this.

  5. #5
    Registered User
    Join Date
    03-08-2010
    Location
    delhi, india
    MS-Off Ver
    Excel 2007
    Posts
    35

    Re: If statements or conditional formatting

    Hi,

    Use below given code, this will worK..
    For reference check attached document.

    Sub Interiorcolor()

    Dim intcolor As String
    Dim i, j As Integer
    Dim lastrow As Long

    Application.ScreenUpdating = False

    lastrow = Sheets("test").Cells(Rows.Count, "B").End(xlUp).Row

    For i = 2 To lastrow

    For j = 2 To 4
    If Cells(i, j).Interior.ColorIndex = 15 Then
    Cells(i, 1).Value = j - 1
    End If
    Next j
    Next i

    Application.ScreenUpdating = True
    End Sub
    Thanks,
    Lokesh
    http://www.Excelcrazy.com
    Attached Files Attached Files

+ 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