find function not working on cells which reference other cells

switters_aka

Board Regular
Joined
Oct 26, 2010
Messages
118
can anyone help me with the following which is probably really simple but it's driving me mental. I am using the find function to establish the row number in a spreadsheet for an edit process.

Code:
wks.Range("B:B").find("something").Row

the cells in Range("B:B") are linked to another worksheet. If I copy paste values on the cells in Range("B:B") the code above works a treat. Any ideas? :confused:
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Try

Code:
wks.Range("B:B").Find(what:="something", LookIn:=xlFormulas, lookat:=xlPart).Row
 
Upvote 0
Thanks VoG. Tried what you suggested but that produced an error too. This is most strange and most frustrating. I have included the complete code below. Is there an issue with the space in the string. I tried changing that to "Installment" & Space(1) & "1" but it didn't make any difference. I am totally stumped. :confused:
Code:
Sub findinstallment()
Dim zrow As Integer
Dim wks As Worksheet
Set wks = Application.Worksheets("ROI")
zrow = wks.Range("B:B").Find(what:="Installment 1", LookIn:=xlFormulas).Row
MsgBox zrow
End Sub
 
Upvote 0
I would check for leading and trailing spaces or maybe extra spaces between Installment and 1.

I would code it like this

Code:
Sub findinstallment()
Dim zrow As Integer, Found As Range
Dim wks As Worksheet
Set wks = Application.Worksheets("ROI")
Set Found = wks.Range("B:B").Find(what:="Installment 1", LookIn:=xlFormulas)
If Found Is Nothing Then
    MsgBox "Not found"
Else
    zrow = Found.Row
    MsgBox zrow
End If
End Sub
 
Upvote 0
Hi there,

You make mention in the thread title and post one that the cells refer to another sheet. Do we know for sure what the value is (that is, the word(s)/number/etc) that will appear in the sheet we are searching? If yes, I believe you want to change to xlValues.

Mark
 
Upvote 0

Forum statistics

Threads
1,214,815
Messages
6,121,715
Members
449,049
Latest member
THMarana

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