Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Can't iterate thru a row with For

I'm trying to access the cells in a Row in the simplest manner, which I
assume is a For Each loop, but it doesn't work. Have I done something
wrong or is it VBA or Excel?
Thanks,
Peter.

Dim rRow3 As Range, rCell As Range
Set rRow3 = Rows(3)
rRow3.Interior.ColorIndex = iPink ' row 3 = pink
For Each rCell In rRow3
rCell.Interior.ColorIndex = iClear
' clears whole row!
If rCell.Value = "." Then ' type mismatch at runtime


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Can't iterate thru a row with For

Hi Peter,

Try changing:

For Each rCell In rRow3


to

For Each rCell In rRow3.Cells


---
Regards,
Norman



"peter" wrote in message
...
I'm trying to access the cells in a Row in the simplest manner, which I
assume is a For Each loop, but it doesn't work. Have I done something
wrong or is it VBA or Excel?
Thanks,
Peter.

Dim rRow3 As Range, rCell As Range
Set rRow3 = Rows(3)
rRow3.Interior.ColorIndex = iPink ' row 3 = pink
For Each rCell In rRow3
rCell.Interior.ColorIndex = iClear
' clears whole row!
If rCell.Value = "." Then ' type mismatch at runtime


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Can't iterate thru a row with For

Thanks a lot Norman,
Peter.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
SOLVER does not iterate / work BHatMJ Excel Discussion (Misc queries) 4 August 12th 09 10:42 PM
How can I iterate numbering when printing Jbird Excel Discussion (Misc queries) 1 August 18th 07 05:28 AM
How to make a Macro Iterate Elisha Excel Programming 1 June 15th 04 08:26 PM
Iterate columns wired Excel Programming 9 November 14th 03 11:14 PM


All times are GMT +1. The time now is 12:59 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"