Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Find Method in For Loop

Hello All,

I am using the Find Method in a For Loop, and it is working as one
would expect when the "What" argument is set to a value that occurs in
the first 1097 rows of the search range. If the value occurs after the
1097th row, the method returns an empty range. Any ideas as to what
could be causing this?

I am running Windows XP Pro, Excel 2003 and VB 6.3. I appreciate any
effort to help me. Thank you for your time and consideration.

Sincerely,
Sisilla

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Find Method in For Loop

I didn't run into that limitation in a quick test. To duplicate what I did
fill in "abc" from A1 to A2000 and run this code:

Sub a()
Dim firstAddress As String
Dim c As Range
With Range("a1:a2000")
Set c = .Find("abc")
If Not c Is Nothing Then
firstAddress = c.Address
Do
Set c = .FindNext(c)
c.Offset(0, 1).Value = "x"
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With
End Sub

It puts an "x" next to all 2000 "abc"s

--
Jim
"Sisilla" wrote in message
oups.com...
| Hello All,
|
| I am using the Find Method in a For Loop, and it is working as one
| would expect when the "What" argument is set to a value that occurs in
| the first 1097 rows of the search range. If the value occurs after the
| 1097th row, the method returns an empty range. Any ideas as to what
| could be causing this?
|
| I am running Windows XP Pro, Excel 2003 and VB 6.3. I appreciate any
| effort to help me. Thank you for your time and consideration.
|
| Sincerely,
| Sisilla
|


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Find Method in For Loop

Jim,

Thank you for your reply. I appreciate your efforts to help me.

In your code, you are using the FindNext method after the first row,
but I am experiencing problems with the Find method. Let me explain a
little further about what I am attempting to do.

I am looping through each cell in a column. In each iteration, I am
searching for the value of that particular cell in another column
using the Find method. I do not think that I can use the FindNext
method in this situation, but I may be wrong. I appreciate any further
advice. Again, thanks.

Sincerely,
Sisilla

On May 1, 4:38 pm, "Jim Rech" wrote:
I didn't run into that limitation in a quick test. To duplicate what I did
fill in "abc" from A1 to A2000 and run this code:

Sub a()
Dim firstAddress As String
Dim c As Range
With Range("a1:a2000")
Set c = .Find("abc")
If Not c Is Nothing Then
firstAddress = c.Address
Do
Set c = .FindNext(c)
c.Offset(0, 1).Value = "x"
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With
End Sub

It puts an "x" next to all 2000 "abc"s

--
Jim"Sisilla" wrote in message

oups.com...
| Hello All,
|
| I am using the Find Method in a For Loop, and it is working as one
| would expect when the "What" argument is set to a value that occurs in
| the first 1097 rows of the search range. If the value occurs after the
| 1097th row, the method returns an empty range. Any ideas as to what
| could be causing this?
|
| I am running Windows XP Pro, Excel 2003 and VB 6.3. I appreciate any
| effort to help me. Thank you for your time and consideration.
|
| Sincerely,
| Sisilla
|



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Find Method in For Loop

It turns out that I was limiting the search range to the first 1097
rows. There is no Excel limit. It's working now. Thank you for your
help, Jim.

On May 1, 4:59 pm, Sisilla wrote:
Jim,

Thank you for your reply. I appreciate your efforts to help me.

In your code, you are using the FindNext method after the first row,
but I am experiencing problems with the Find method. Let me explain a
little further about what I am attempting to do.

I am looping through each cell in a column. In each iteration, I am
searching for the value of that particular cell in another column
using the Find method. I do not think that I can use the FindNext
method in this situation, but I may be wrong. I appreciate any further
advice. Again, thanks.

Sincerely,Sisilla

On May 1, 4:38 pm, "Jim Rech" wrote:



I didn't run into that limitation in a quick test. To duplicate what I did
fill in "abc" from A1 to A2000 and run this code:


Sub a()
Dim firstAddress As String
Dim c As Range
With Range("a1:a2000")
Set c = .Find("abc")
If Not c Is Nothing Then
firstAddress = c.Address
Do
Set c = .FindNext(c)
c.Offset(0, 1).Value = "x"
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With
End Sub


It puts an "x" next to all 2000 "abc"s


--
Jim"Sisilla" wrote in message


roups.com...
| Hello All,
|
| I am using the Find Method in a For Loop, and it is working as one
| would expect when the "What" argument is set to a value that occurs in
| the first 1097 rows of the search range. If the value occurs after the
| 1097th row, the method returns an empty range. Any ideas as to what
| could be causing this?
|
| I am running Windows XP Pro, Excel 2003 and VB 6.3. I appreciate any
| effort to help me. Thank you for your time and consideration.
|
| Sincerely,
|Sisilla
|- Hide quoted text -


- Show quoted text -



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
Macro/Method of Importing DATA in a loop Faraz A. Qureshi Excel Discussion (Misc queries) 2 August 5th 09 07:34 AM
xls vba find method to find row that contains the current date RCranston Excel Programming 3 March 28th 07 03:59 PM
Copy method of worksheet class failed - loop copying worksheets lif[_12_] Excel Programming 0 July 31st 06 10:02 PM
Loops to find blanks then loop to find populated Bevy Excel Programming 0 June 1st 06 04:50 PM
Using variables to make a date and using find method to find that. KyWilde Excel Programming 2 April 21st 05 09:43 PM


All times are GMT +1. The time now is 01:53 AM.

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

About Us

"It's about Microsoft Excel"