Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 440
Default Validate userform textbox entry with Sheet range.

Users can input numeric values into Textbox 1 on userform1.
Upon exit from the textbox, how do I check Sheet1, column D for the same
value (ie a duplicate)?
tia
--
Traa Dy Liooar

Jock
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Validate userform textbox entry with Sheet range.

Something like the below..

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If WorksheetFunction.CountIf(Sheets("Sheet1").Range(" D:D"), _
TextBox1.Text) 0 Then
TextBox1.Text = "": MsgBox "Already Exists": Cancel = True
End If
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Jock" wrote:

Users can input numeric values into Textbox 1 on userform1.
Upon exit from the textbox, how do I check Sheet1, column D for the same
value (ie a duplicate)?
tia
--
Traa Dy Liooar

Jock

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default Validate userform textbox entry with Sheet range.

Private Sub TextBox1_Change()
Set lookv = Sheets("sheet1").Range("D:D")
text1 = Trim(UserForm1.TextBox1.Value)
With Application.WorksheetFunction
If .CountIf(lookv, text1) 1 And text1 < "" Then MsgBox "dup entry"
End With
End Sub



On Oct 19, 4:26*pm, Jock wrote:
Users can input numeric values into Textbox 1 on userform1.
Upon exit from the textbox, how do I check Sheet1, column D for the same
value (ie a duplicate)?
tia
--
Traa Dy Liooar

Jock


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Validate Textbox/Userform Number Range Ingo Excel Programming 1 April 7th 09 12:19 PM
Validate Textbox/Userform Number Range Ingo Excel Programming 0 April 2nd 09 01:00 PM
date entry in userform textbox tkraju via OfficeKB.com Excel Programming 7 June 9th 08 08:30 AM
Validate textbox entry Stuart[_21_] Excel Programming 2 May 13th 05 07:31 PM
Validate Textbox entry David Seebaran Excel Programming 3 April 18th 04 06:26 PM


All times are GMT +1. The time now is 04:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"