ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Loop criteria based on cell value and color (https://www.excelbanter.com/excel-programming/351473-loop-criteria-based-cell-value-color.html)

Jim at Eagle

Loop criteria based on cell value and color
 
If rng.Value = Val1 & Interior.ColorIndex = 36 Then

how do I get there
--
Jim at Eagle

Chip Pearson

Loop criteria based on cell value and color
 
I don't understand your question. What does it have to do with
looping? Your syntax is wrong. Use "And" not "&".

If rng.Value = Val1 And rng.Interior.ColorIndex = 36 Then


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Jim at Eagle" wrote in
message
...
If rng.Value = Val1 & Interior.ColorIndex = 36 Then

how do I get there
--
Jim at Eagle




Jim at Eagle

Loop criteria based on cell value and color
 
Sorry, here is what I'm trying to do. With named range selected
the code I used, If rng.Value = Val1 Then
when the program finds a value that equals Val1 then it takes the value of
the cell offset by one column and adds it to a variable and accumulates a
total value based on Val1 and then places that total value in a new location.
I can nest another IF statement for additional criteria but would prefer to
use something like this,
If rng.Value = Val1 And rng.Interior.ColorIndex = 36 Then
The use of and is the question



All times are GMT +1. The time now is 08:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com