Find Method question

  • Thread starter Thread starter CG Rosén
  • Start date Start date
C

CG Rosén

Good Morning Group,

Have following problem with the Find Method in the code below.
If the ActiveSheet Range contains values like 1 and 11 (or 2 and 22 etc)
the code below does not find the value 1 but always the value 11.
The search range is formatted as "general".

Thankful for any hints.

Brgds

CG Rosén
--------------------------------------------------------------------------
For I = 1 to 6

With ActiveSheet.Range("A" & I & ":" & "X" & I)
Set k = .Find(TextBox1, LookIn:=xlValues)
If k Is Nothing Then
k = 0
End If
End With

Next I
 
CG,

That should not be a problem. Are you sure that the value you are looking
for is just a 1, and doesn't have leading or trailing spaces? Step through
the code and do a ?LEN(Textbox1) in the immediate window when you get to
the Find statement.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Back
Top