Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

seltext

Status
Not open for further replies.

Johnny42

Technical User
Jul 13, 2004
127
CA
I'm usingthis to check for duplicates ...however I cannot get the seltext to work,...


Private Sub TB_BOM_Exit(ByVal Cancel As MSForms.ReturnBoolean)
'msgbox TB_
With Sheet1.Range("R1:R1000") 'TB_BOM.Text

Set C = .Find(TB_BOM.Value, LookIn:=xlFormulas, LookAt:=xlWhole)

If Not C Is Nothing Then
Cancel = True
MsgBox "dupPLICATE..."
With Me.TB_BOM
.SetFocus
.SelStart = Len(TB_BOM.Text) '- 1
.SelLength = 1

End With
End If
End With
'TB_BOM.SetFocus
End Sub
 
I think that your .SelStart should be 1 and and your .SelLength should be Len(TB_BOM.Text).

I hope this helps.

Ron

Ron Repp
 
and how is it not working ?

Rgds, Geoff

Three things are certain. Death, taxes and lost data. DPlank is to blame

Please read FAQ222-2244 before you ask a question
 
Well if there is no match the text does not get selected....
 
wow...soooooo sorry....

.SelStart = Len(TB_BOM.Text) '- 1
.SelLength = 1
should be

.SelStart = 0
.SelLength = Len(TB_BOM.Text)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top