View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] akrosita2000@hotmail.com is offline
external usenet poster
 
Posts: 2
Default VB Code Highlight Rows Based on Color Index

Can someone please help me with VB code for the following process:

I have a list of items in column A (a database query linked to Access
table). The items are highlighted in different colors by the end-user.
When I refresh the database query the next day, the colors move around
or dissapear because new items get added to the list.

I added a vb function and call it in a hidden column B to display the
color index of cell A.

If OfText = True Then
CellColorIndex = InRange(1, 1).Font.ColorIndex
Else
CellColorIndex = InRange(1, 1).Interior.ColorIndex
End If

So, for example, cell A2 is highlighted in yellow, thus cell B2
displays number "6".

How can I create a vb code with a loop to go through the rows and
highlight the rows based on the value in column B?

Hopefully this makes sense.

Thank you in advance!