Need urgent help
MZ Tools makes life easier for the Excel VBA coder
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: Need urgent help

  1. #1
    New Member
    Join Date
    Mar 2002
    Posts
    1
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    I have an excel spreadsheet with entire rows marks with different color's. Depending upon the row color I want to populate a new column.
    ie if the row color is Red then the column value should be say 'R'


  2. #2
    MrExcel MVP Barrie Davidson's Avatar
    Join Date
    Feb 2002
    Location
    Winnipeg
    Posts
    2,330
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    On 2002-03-08 12:59, sku wrote:
    I have an excel spreadsheet with entire rows marks with different color's. Depending upon the row color I want to populate a new column.
    ie if the row color is Red then the column value should be say 'R'

    This UDF (User Defined Function) will return a value that identifies the colour of a cell. You could use this to determine your data for your new column.


    Function Color_Index(CellRange As Range) As Double

    Application.Volatile
    Color_Index = CellRange.Interior.ColorIndex

    End Function


    To use this, you first must paste it in to a module. ALT+F11 will open the Visual Basic Editor window. You then need to select the file you want to paste the code in. You can select the file in the Project Explorer window (you'll see your open files in this window. It looks similar to Windows Explorer) and select Insert|Module. This will open a new module window. Paste the code in that window. To use the formula, the syntax is:

    =BookName.xls!Color_Index(A1)

    where "BookName" is the name of the file you pasted the code in.
    Note - this will return an error if you select more than one cell.

    Regards,

    Barrie Davidson

    "You're only given a little spark of madness. You mustn't lose it." - Robin Williams

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
  •  

 

 
DMCA.com