ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Evaluate cell in range and change cell attribute (https://www.excelbanter.com/excel-programming/409081-evaluate-cell-range-change-cell-attribute.html)

S Himmelrich

Evaluate cell in range and change cell attribute
 
I've been working on the following code, but get an error on the
designated line - can someone help?

Dim rCell As Range
Sheets("Form").Select
Range("B2:C450").Select
For Each rCell In Selection.Cells
If rCell.Interior.ColorIndex = 35 And rCell.Value = "" Then <---
ERROR OCCURS
rCell.Borders.Color = 3
End If
Next rCell

Mike H

Evaluate cell in range and change cell attribute
 
What error because there's nothing wrong with the code

Mike

"S Himmelrich" wrote:

I've been working on the following code, but get an error on the
designated line - can someone help?

Dim rCell As Range
Sheets("Form").Select
Range("B2:C450").Select
For Each rCell In Selection.Cells
If rCell.Interior.ColorIndex = 35 And rCell.Value = "" Then <---
ERROR OCCURS
rCell.Borders.Color = 3
End If
Next rCell


S Himmelrich

Evaluate cell in range and change cell attribute
 
I get a type mismatch

if I put this line I still get an object error

If rCell.Interior.ColorIndex = 35 And rCell.Value Is Null Then

Not sure what is going on...humm...



On Apr 9, 5:04*pm, Mike H wrote:
What error because there's nothing wrong with the code

Mike



"S Himmelrich" wrote:
I've been working on the following code, but get an error on the
designated line - can someone help?


* Dim rCell As Range
* * *Sheets("Form").Select
* * *Range("B2:C450").Select
* For Each rCell In Selection.Cells
* * If rCell.Interior.ColorIndex = 35 And rCell.Value = "" Then *<---
ERROR OCCURS
* * * rCell.Borders.Color = 3
* * * End If
* Next rCell- Hide quoted text -


- Show quoted text -



Mike H

Evaluate cell in range and change cell attribute
 
That's different than the code you posted yesterday when you were using ""

try this line

If rCell.Interior.ColorIndex = 35 And IsNull(rCell.Value) Then

Mike

"S Himmelrich" wrote:

I get a type mismatch

if I put this line I still get an object error

If rCell.Interior.ColorIndex = 35 And rCell.Value Is Null Then

Not sure what is going on...humm...



On Apr 9, 5:04 pm, Mike H wrote:
What error because there's nothing wrong with the code

Mike



"S Himmelrich" wrote:
I've been working on the following code, but get an error on the
designated line - can someone help?


Dim rCell As Range
Sheets("Form").Select
Range("B2:C450").Select
For Each rCell In Selection.Cells
If rCell.Interior.ColorIndex = 35 And rCell.Value = "" Then <---
ERROR OCCURS
rCell.Borders.Color = 3
End If
Next rCell- Hide quoted text -


- Show quoted text -




S Himmelrich

Evaluate cell in range and change cell attribute
 
Thank you for your response, this didn't work either.

On Apr 10, 6:13*am, Mike H wrote:
That's different than the code you posted yesterday when you were using ""

try this line

If rCell.Interior.ColorIndex = 35 And IsNull(rCell.Value) Then

Mike



"S Himmelrich" wrote:
I get a type mismatch


if I put this line I still get an object error


* * If rCell.Interior.ColorIndex = 35 And rCell.Value Is Null Then


Not sure what is going on...humm...


On Apr 9, 5:04 pm, Mike H wrote:
What error because there's nothing wrong with the code


Mike


"S Himmelrich" wrote:
I've been working on the following code, but get an error on the
designated line - can someone help?


* Dim rCell As Range
* * *Sheets("Form").Select
* * *Range("B2:C450").Select
* For Each rCell In Selection.Cells
* * If rCell.Interior.ColorIndex = 35 And rCell.Value = "" Then *<---
ERROR OCCURS
* * * rCell.Borders.Color = 3
* * * End If
* Next rCell- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -




All times are GMT +1. The time now is 04:06 AM.

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