Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default VBA: How to iterate through each cell of one specific row

This seems like a simple task but I can't find anything in
the docs or Google.

How, using VBA, can I iterate through each used cell of a
specific row? For instance perform a test on each cell of
row 2?

I tried this, but it seems to select every cell of the
whole sheet:

For Each cell In ActiveSheet.UsedRange.Rows(2)


Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default How to iterate through each cell of one specific row

Hank,

Try

Dim Cell As Range
For Each Cell In ActiveSheet.UsedRange.Rows(2).Cells


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




"Hank" wrote in message
...
This seems like a simple task but I can't find anything in
the docs or Google.

How, using VBA, can I iterate through each used cell of a
specific row? For instance perform a test on each cell of
row 2?

I tried this, but it seems to select every cell of the
whole sheet:

For Each cell In ActiveSheet.UsedRange.Rows(2)


Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How to iterate through each cell of one specific row

That did the trick. Boy, do I feel silly!

Thanks from a newbie,
Hank


-----Original Message-----
Hank,

Try

Dim Cell As Range
For Each Cell In ActiveSheet.UsedRange.Rows(2).Cells


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




"Hank" wrote in

message
...
This seems like a simple task but I can't find anything

in
the docs or Google.

How, using VBA, can I iterate through each used cell of

a
specific row? For instance perform a test on each cell

of
row 2?

I tried this, but it seems to select every cell of the
whole sheet:

For Each cell In ActiveSheet.UsedRange.Rows(2)


Thanks.



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default VBA: How to iterate through each cell of one specific row

Not for me.

Alan Beban

Hank wrote:
This seems like a simple task but I can't find anything in
the docs or Google.

How, using VBA, can I iterate through each used cell of a
specific row? For instance perform a test on each cell of
row 2?

I tried this, but it seems to select every cell of the
whole sheet:

For Each cell In ActiveSheet.UsedRange.Rows(2)


Thanks.


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
Iterate Circular Reference Brandt Excel Discussion (Misc queries) 1 August 3rd 05 11:43 PM
Iterate though all open spreadsheets J Shrimps, Jr. Excel Worksheet Functions 1 March 10th 05 02:38 AM
Iterate columns wired Excel Programming 9 November 14th 03 11:14 PM


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