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

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Forum statistics

Threads
1,215,723
Messages
6,126,470
Members
449,315
Latest member
misterzim

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