Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default Help with UserForm textbox code

I thought I posted this question last Friday. But, I can't find it.
Maybe I didn't actually finish posting it.....

I have deigned a UserForm that will allow the user to enter some info
that will be copied to a worksheet when the user clicks the OK button.
There are about a dozen fields the user will enter info to.

I have code that will look at the textbox1 entry, and compare it with
the data already in column J of this list, and warn the user if this
data already exists.. This works fine, except that I would like it to
identify this duplicate as soon as the user tabs out of textbox1. Right
now, it will perform this check only after the OK button is clicked,
when the whole UserForm is completed. I'd like to save the user from
entering in all the data that will not be copied to the list anyway.

Here is the current code to perform the check to find a duplicate when
it compares the textbox1 entry vs entries in column J of the worksheet:

With Worksheets("Official list")
If Application.CountIf(.Range("j:j"), TextBox1.Text) 0 Then
MsgBox "This PO/PL is already on the list. Please edit the existing
record "
TextBox1.Text = Clear

Else

Range("J65536").End(xlUp)(2).Select
Application.Selection.Value = TextBox1.Text

End If

End With


Thanks for your help/suggestions.
J.O.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Help with UserForm textbox code

Hi,
Add this to the Uerform code:

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)

With Worksheets("Official list")
If Application.CountIf(.Range("j:j"), TextBox1.Text) 0 Then
MsgBox "This PO/PL is already on the list. Please edit the existing
Record """
TextBox1.Text = Clear

Else

Range("J65536").End(xlUp)(2).Select
Application.Selection.Value = TextBox1.Text

End If

End With

End Sub


HTH

"excelnut1954" wrote:

I thought I posted this question last Friday. But, I can't find it.
Maybe I didn't actually finish posting it.....

I have deigned a UserForm that will allow the user to enter some info
that will be copied to a worksheet when the user clicks the OK button.
There are about a dozen fields the user will enter info to.

I have code that will look at the textbox1 entry, and compare it with
the data already in column J of this list, and warn the user if this
data already exists.. This works fine, except that I would like it to
identify this duplicate as soon as the user tabs out of textbox1. Right
now, it will perform this check only after the OK button is clicked,
when the whole UserForm is completed. I'd like to save the user from
entering in all the data that will not be copied to the list anyway.

Here is the current code to perform the check to find a duplicate when
it compares the textbox1 entry vs entries in column J of the worksheet:

With Worksheets("Official list")
If Application.CountIf(.Range("j:j"), TextBox1.Text) 0 Then
MsgBox "This PO/PL is already on the list. Please edit the existing
record "
TextBox1.Text = Clear

Else

Range("J65536").End(xlUp)(2).Select
Application.Selection.Value = TextBox1.Text

End If

End With


Thanks for your help/suggestions.
J.O.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default Help with UserForm textbox code

Thanks Toppers

I have a different twist of this problem. The problem you responded to,
I figured out. I had the coding in the wrong sub. I thought I removed
the post before anyone would respond to it.

HOWEVER
If you read my new entry I just entered, maybe you can help with this
problem.

Thanks,
J.O.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default Help with UserForm textbox code

Please see the new post Coding questions about UserForm TextBox.

I have this one all screwed up...

Thanks,
J.O.

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
TEXTBOX in USERFORM RUUD VAN DEURSEN Excel Programming 5 March 1st 05 03:36 PM
userform textbox Phil Excel Worksheet Functions 5 January 16th 05 06:59 PM
Adding TextBox to UserForm via code krzychu58 Excel Programming 1 September 24th 04 03:24 PM
Textbox in userform shaharul[_6_] Excel Programming 3 April 15th 04 12:54 PM
UserForm TextBox to ActiveSheet TextBox over 256 characters Dan E[_2_] Excel Programming 1 July 28th 03 07:36 PM


All times are GMT +1. The time now is 05:40 PM.

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"