Unable to get the Find property of the WorksheetFunction Cla

ronenbitman

New Member
Joined
Jul 26, 2004
Messages
14
Hi,

i have an error Runtime Error:
Runtime Error 1004:
Unable to get the Find property of the WorksheetFunction Class

what happens is:

NameNumText = Cells(iRow, PaperNumCol)
iSpacePosition = WorksheetFunction.Find(" ", NameNumText)
Cells(iRow, PaperNameCol) = Mid(NameNumText, 1, iSpacePosition - 1)
Cells(iRow, PaperNumCol) = Mid(NameNumText, iSpacePosition + 1, Len _(NameNumText) - iSpacePosition)

these are the three lines what they should do is cell A has the value:
"111 ABCD"
i am giving iSpacePosition the Find of space withing cell A (answer is 4)
then Cell A gets "111"
and cell B gets "ABCD"
as expected.
but if Cell A contains "111" then i want excel to result in "111"
what happens is when Find can not find the Sub string it returns "#Value"
and then I get the error, how can i handle the #Value error so it will work?

10x 4 the help
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Juan Pablo González

MrExcel MVP
Joined
Feb 8, 2002
Messages
11,959
Re: Unable to get the Find property of the WorksheetFunction

Use InStr() instead to look for the space, it will return 0 if its not found.
 

Forum statistics

Threads
1,147,508
Messages
5,741,572
Members
423,668
Latest member
Audorin

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
Top