#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default c.Resize

This part of my macro runs perfectly:

For Each c In Range("D6:D61")
If c.Resize(, 15).Interior.ColorIndex = xlNone Then
c.Offset(, -1).Interior.ColorIndex = 6

It runs though the rows, checks for xlNone and changes the color of the
offset cell.

I would also like it to check the rows and if all cells in a row are blank,
change the color of the offset cell.

I have tried several variations such as:

For Each c In Range("D6:D61")
If c.Resize(, 15).Value = "" Then
c.Offset(, -1).Interior.ColorIndex = 6

But no luck.

Thanks

CR


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default c.Resize

Hi

Try this:

For Each c In Range("D6:D61")
If WorksheetFunction.CountBlank(c.Resize(, 15)) = 15 Then
c.Offset(, -1).Interior.ColorIndex = 6
End If
Next

Regards,
Per

"CR" skrev i meddelelsen
m...
This part of my macro runs perfectly:

For Each c In Range("D6:D61")
If c.Resize(, 15).Interior.ColorIndex = xlNone Then
c.Offset(, -1).Interior.ColorIndex = 6

It runs though the rows, checks for xlNone and changes the color of the
offset cell.

I would also like it to check the rows and if all cells in a row are
blank, change the color of the offset cell.

I have tried several variations such as:

For Each c In Range("D6:D61")
If c.Resize(, 15).Value = "" Then
c.Offset(, -1).Interior.ColorIndex = 6

But no luck.

Thanks

CR


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default c.Resize

Hi

This will clas with the first check because your color filling the same
range but here's the corected code for the second part

For Each c In Range("D6:D61")
If WorksheetFunction.CountA(c.Resize(, 15)) = 0 Then
c.Offset(, -1).Interior.ColorIndex = 6
End If
Next

Mike

"CR" wrote:

This part of my macro runs perfectly:

For Each c In Range("D6:D61")
If c.Resize(, 15).Interior.ColorIndex = xlNone Then
c.Offset(, -1).Interior.ColorIndex = 6

It runs though the rows, checks for xlNone and changes the color of the
offset cell.

I would also like it to check the rows and if all cells in a row are blank,
change the color of the offset cell.

I have tried several variations such as:

For Each c In Range("D6:D61")
If c.Resize(, 15).Value = "" Then
c.Offset(, -1).Interior.ColorIndex = 6

But no luck.

Thanks

CR



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default c.Resize

It's the same range but filling on a different criteria. And I am going to
change the index to 4.

Thank you all for the help. It now works.



"Mike H" wrote in message
...
Hi

This will clas with the first check because your color filling the same
range but here's the corected code for the second part

For Each c In Range("D6:D61")
If WorksheetFunction.CountA(c.Resize(, 15)) = 0 Then
c.Offset(, -1).Interior.ColorIndex = 6
End If
Next

Mike

"CR" wrote:

This part of my macro runs perfectly:

For Each c In Range("D6:D61")
If c.Resize(, 15).Interior.ColorIndex = xlNone Then
c.Offset(, -1).Interior.ColorIndex = 6

It runs though the rows, checks for xlNone and changes the color of the
offset cell.

I would also like it to check the rows and if all cells in a row are
blank,
change the color of the offset cell.

I have tried several variations such as:

For Each c In Range("D6:D61")
If c.Resize(, 15).Value = "" Then
c.Offset(, -1).Interior.ColorIndex = 6

But no luck.

Thanks

CR





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Resize Les Excel Programming 2 June 11th 08 06:07 AM
I could NOT resize the axis title but excel allows me to resize gr Iwan Setiyono Ko Charts and Charting in Excel 4 June 6th 06 04:46 AM
RESIZE PROPERTY: is it possible to resize "up" and "to the left"? Myles[_57_] Excel Programming 1 March 22nd 06 04:57 AM
I could NOT resize the axis title but excel allows me to resize gr Iwan Setiyono Ko Charts and Charting in Excel 0 March 15th 06 10:34 AM
Need some help with Resize. Thanks John Wirt[_2_] Excel Programming 2 July 31st 03 08:37 AM


All times are GMT +1. The time now is 03:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"