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!

Comparing cells in a row

Status
Not open for further replies.

skyel

Programmer
Jul 31, 2003
10
CA
I have an 2d array with values in it. The basic structure for each row in the table is:

Name | Detail 1a |Detail 2a | Detail 1b | Detail 2b...

I want to compare all the detail 1's with each other and then all the Detail 2's with each other. If any of the compared details do not match, I want the row to be highlighted.

This is what I have so far:

Code:
For i = 1 to intRows - 1
	blnSame = True
		
	For j = 2 to intColumns - 1
		if Data(i, 1) <> Data(i, j) Then
		blnSame = False
		End if
	Next 
				
'Set alternating row colors
	If blnSame = False Then
		 'Different, highlight blue
			color=&quot;#B3BCFF&quot;
	ElseIf i mod 2 = 0 Then
		' Gray row
			color=&quot;#DDDDDE&quot;
	Else
		' White row
			color=&quot;#FFFFFF&quot;
	End if

I think I'm missing something, but I'm not sure what... Any help would be greatly appreciated. :)

-Skye.
 
Thanks for the link. However, I'm not having trouble with alternating row colours, it's the highlighting rows in which the values don't match up that I'm having difficulty with...

-Skye
 
HI!
Sorry didn't look closely....I can't see all the code but it seems to me that &quot;endif&quot;s are not in places correctly/corss-conditioning itself...try using only one condition IF-END IF _and see if u get the output for only case A....
All the best!

> need more info?
:: don't click HERE ::
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top