#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 156
Default Question

Dim oCell As Excel.Range
Dim oSheet As Excel.Worksheet
Set oSheet = ActiveSheet


With Worksheets("MySheet")
For Each oCell in
oSheet.Range("F1:F30").SpecialCells(xlCellTypeCons tants)

Debug.Print Target.row
Next
End With

Stepping through this repeatedly prints 8. (Sometimes 11)

What makes it an 8, and why does it not move to the next row?

Thanks - Kirk
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Question

Is it because you use

Debug.Print Target.Row

whereas your range object is called oCell, so you should use

Debug.Print oCell.Row


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"kirkm" wrote in message
...
Dim oCell As Excel.Range
Dim oSheet As Excel.Worksheet
Set oSheet = ActiveSheet


With Worksheets("MySheet")
For Each oCell in
oSheet.Range("F1:F30").SpecialCells(xlCellTypeCons tants)

Debug.Print Target.row
Next
End With

Stepping through this repeatedly prints 8. (Sometimes 11)

What makes it an 8, and why does it not move to the next row?

Thanks - Kirk



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 156
Default Question

On Sat, 16 Sep 2006 07:58:21 +0100, "Bob Phillips"
wrote:

Is it because you use

Debug.Print Target.Row

whereas your range object is called oCell, so you should use

Debug.Print oCell.Row


Hi Bob,

Yes, hmmmm, but it just prints 1,2,3,4 instead of the
required rows. I'm not telling it what to look for - and can't see
where to.

Thanks - Kirk
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Question

Yes, you are indicating Constants ;
For Each oCell in oSheet.Range("F1:F30").SpecialCells(xlCellTypeCons tants)

So it depends what you consider "the required rows" .

NickHK

"kirkm" wrote in message
...
On Sat, 16 Sep 2006 07:58:21 +0100, "Bob Phillips"
wrote:

Is it because you use

Debug.Print Target.Row

whereas your range object is called oCell, so you should use

Debug.Print oCell.Row


Hi Bob,

Yes, hmmmm, but it just prints 1,2,3,4 instead of the
required rows. I'm not telling it what to look for - and can't see
where to.

Thanks - Kirk



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
Newbie Question - Subtraction Formula Question [email protected] Excel Discussion (Misc queries) 3 May 5th 06 05:50 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good davegb Excel Programming 1 May 6th 05 06:35 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 0 April 27th 05 07:46 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 23 April 23rd 05 09:26 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 0 April 22nd 05 03:30 PM


All times are GMT +1. The time now is 11:55 PM.

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"