+ Reply to Thread
Results 1 to 3 of 3

Function to read cell color and insert Letter?

Hybrid View

  1. #1
    Registered User
    Join Date
    03-23-2009
    Location
    usa
    MS-Off Ver
    Excel 2003, 2013
    Posts
    16

    Function to read cell color and insert Letter?

    I would like to write a function where, if the cell at the bottom is red, insert letter H.
    I'm not verse with vba excel, hope someone could guide me here.

    Function InsertLetter
    If cell.Interior.ColorIndex = 3 then
     cell above insert letter H
    end_if
    55ab19201af24.png

  2. #2
    Valued Forum Contributor
    Join Date
    09-17-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    Excel 2007
    Posts
    454

    Re: Function to read cell color and insert Letter?

    Try this:
    Public Function ColorFlag(Cell As Excel.Range) As String
        Application.Volatile
        Select Case Cell.Interior.ColorIndex
            Case 3
                ColorFlag = "H"
            Case 4 'next color test etc.
                ColorFlag = "J"
            Case Else
                ColorFlag = ""
        End Select
    End Function

  3. #3
    Registered User
    Join Date
    03-23-2009
    Location
    usa
    MS-Off Ver
    Excel 2003, 2013
    Posts
    16

    Re: Function to read cell color and insert Letter?

    Works great! THanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Insert Comma before first Capital Letter in cell
    By Kevy Kev in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 05-11-2014, 10:25 AM
  2. [SOLVED] Change color of cell if a certain letter is in cell
    By durbancic in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-26-2013, 09:13 PM
  3. [SOLVED] Change Color of cell based on specific letter / text
    By steven_e in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-23-2013, 04:46 PM
  4. Macro to insert a letter into first empty cell in a column on all sheets
    By pimind in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-03-2013, 01:56 PM
  5. Make a cell turn a color by typing a letter
    By stixmike in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-21-2012, 12:44 PM
  6. [SOLVED] If the specific letter exists insert blank cell to the right
    By djfscouse in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-29-2012, 05:56 PM
  7. [SOLVED] Insert text to cell based on whether the value begins with a letter or number.
    By BPSJACK in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-23-2012, 09:57 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