Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel macro 1

Status
Not open for further replies.

bobibob

Technical User
Jun 28, 2001
13
SI
Hi!

I have a big table written in excel where rows are in different colors.

I would like to export rows which are colored in particular color to a text file where the data in a row would be comma separated!

Can someone help me write a macro which would solve this problem?

Sorry for bad English
 
I assume it's the cell color you are reffering to and not text color.

Fir example if the cells in Column A are colored, then you can create a macro to give you the color number of the cell and have the color number in column B. The when you sort column B, all like colored cell will be together; at which point you can copy, paste, export them.

Specific instructions:
Go to Tools, Macro, Visual Basic Editor, Insert, Module and copy the following UDF

Function SCI(rcell)
SCI = rcell.Interior.ColorIndex
End Function


Then when you type in a formula in cell B2
=SCI(A2)

The color index of the cell will show up in cell B2.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top