ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Runtime Error (https://www.excelbanter.com/excel-programming/296879-runtime-error.html)

TomD

Runtime Error
 
Can anyone advise as to why the following produces a
Runtime error 9; "Subscript out of range"

Dim FndRng1 As Range
Dim DivRng1 As Range

Set DivRng1 = ThisWorkbook.Sheets("Medal").Range
("D6:D705")

Set FndRng1 = DivRng1.Find(What:="1", _
After:=DivRng1.Cells(DivRng1.Cells.Count), _
LookIn:=x1Values, _
LookAt:=xlWhole)

If the LookIn statement is removed, no error. I'm
looking for a value returned from a formula in the cell.

Thanks

Tom


Tom Ogilvy

Runtime Error
 
LookIn:=x1Values

should be

Lookin:=xlValues

see the difference - you have the number 1 as the second letter in the
constant and it should be the letter "L"

--
Regards,
Tom Ogilvy

"TomD" wrote in message
...
Can anyone advise as to why the following produces a
Runtime error 9; "Subscript out of range"

Dim FndRng1 As Range
Dim DivRng1 As Range

Set DivRng1 = ThisWorkbook.Sheets("Medal").Range
("D6:D705")

Set FndRng1 = DivRng1.Find(What:="1", _
After:=DivRng1.Cells(DivRng1.Cells.Count), _
LookIn:=x1Values, _
LookAt:=xlWhole)

If the LookIn statement is removed, no error. I'm
looking for a value returned from a formula in the cell.

Thanks

Tom




TomD

Runtime Error
 
Tom,

Well Spotted !!!!

Glad I cut and pasted rather than typed.....

I couldn't (wouldn't) see it for looking

All Ok now. Thanks very much.

Tom

-----Original Message-----
LookIn:=x1Values

should be

Lookin:=xlValues

see the difference - you have the number 1 as the

second letter in the
constant and it should be the letter "L"

--
Regards,
Tom Ogilvy

"TomD" wrote in

message
...
Can anyone advise as to why the following produces a
Runtime error 9; "Subscript out of range"

Dim FndRng1 As Range
Dim DivRng1 As Range

Set DivRng1 = ThisWorkbook.Sheets("Medal").Range
("D6:D705")

Set FndRng1 = DivRng1.Find(What:="1", _
After:=DivRng1.Cells(DivRng1.Cells.Count), _
LookIn:=x1Values, _
LookAt:=xlWhole)

If the LookIn statement is removed, no error. I'm
looking for a value returned from a formula in the

cell.

Thanks

Tom



.



All times are GMT +1. The time now is 12:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com