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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to color code rows by column data

Status
Not open for further replies.

LizzyAnn

Technical User
Nov 5, 2008
73
US
So I have a massive database query that (eventually) turns itself into a single spreadsheet with about 6 columns or so. I need to color code eah row based off of the data in one of the columns. There are only about 9 variables in that column, (thus far), so I can't use conditional formatting. However, I have no idea how to go about this in VB, any help would be appreciated.
 


at the point of this error, please describe what has happened on the sheet. Is the AutoFilter hiding rows and what rows are visible?

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
All rows are visible. I had some of the columns hidden though.
 



However, the macro is HIDING rows, via the AutoFilter. So why are ALL rows visible?

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Is there a reason they wouldn't be visible??
 


What I am saying is that when that statement executes, there should be some rows HIDDEN by the AutoFilter.

If no row are hidden, then there is some other problem.

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 



1) did you color-code your list of names -- the one that is your Named Range?

2) what happens when you run the procedure?

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
OK, so now I have the list of names colored,
and now it hides all the rows except the ones w/o a name in the column...
 



"...except the ones w/o a name in the column..."

How do the names get in the column? Is that not a result of the Query? So why no names?

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 


BTW...

THAT is the problem!!!

I expect there to be a name on every row in the table in my procedure.

When there is not, TILT!!!

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
I expect there to be a name on every row.... that confuses me/
 
Ok, so I found the cells missing data and put the names in...
But now.. no data found error... on this line:

With rng.SpecialCells(xlCellTypeVisible).Interior
 



And what cells a visible?

What CRITERIA is applied to the AutoFilter column?

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Well, now all the cells are visible again...

define what you mean by "Criteria
 


In the query results column that contains your names, hit your AutoFilter button and select (Custom...)

What do you see?



Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 



Is your heading for this field in F1?

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Yes.
Column F is the one where the names are from the data, and I is where the "DataValueList" is.
 

and if you

select cell F1

hit the [END] key

hit the [DOWN ARROW] key

tell me what happens.

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top