Error reading range

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
2,097
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
VBA Code:
Look = xlComments
SearchPart = xlPart
rCol= "C2:C58"
Set Found = Range(rCol).Find(What:=TextBox1.Text, lookIn:=Look, Lookat:=SearchPart)
If Not Found Is Nothing Then
    Set FirstFound = Found
    Do
        Debug.Print Found, Found.Address
        Set Found = Range(rCol).FindNext(After:=Found)
    Loop Until FirstFound.Address = Found.Address
End If
The last address it prints is C59. That's one more than the range should have and I get error
Run-time error '1004':
Unable to get the FindNext property of the Range class


But if rCol is "C:C" there is no error.
Is how I'm defining the rows or range wrong?
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,224,812
Messages
6,181,098
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top