LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,276
Default userform duplicate control not working in my code. Thank you

Hi I have created a userform with the code as follow and I need to do two
things, first to check if the information entered in the user form already
exist and secondly to have a calculation done in the user form ( they enter
three different values and the 4th box give the total). I try to solve the
first one as you will see in my code but it doesn't work. Thank you in Advance

Private Sub cmdAdd_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Projects")

'find first empty row in database
iRow = ws.Cells(Rows.Count, 2) _
.End(xlUp).Offset(1, 0).Row

'check for a project number
If Trim(Me.TxtProjectname.Value) = "" Then
Me.TxtProjectname.SetFocus
MsgBox "Please enter a project number"
Exit Sub
End If

'copy the data to the database
ws.Cells(iRow, 3).Value = Me.TxtProjectname.Value
ws.Cells(iRow, 2).Value = Me.TxtClient.Value
ws.Cells(iRow, 8).Value = Me.TxtImplementation.Value
ws.Cells(iRow, 9).Value = Me.TxtConsulting.Value
ws.Cells(iRow, 10).Value = Me.TxtDevelopment.Value
If IsNumeric(Application.Match(Me.TxtProjectname, [c:c], 0)) Then
MsgBox "INFORMATION ALREADY IN DATA SHEET"
End If


'clear the data
Me.TxtProjectname.Value = ""
Me.TxtClient.Value = ""
Me.TxtImplementation.Value = ""
Me.TxtConsulting.Value = ""
Me.TxtDevelopment.Value = ""

Me.TxtProjectname.SetFocus




End Sub
 
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
Refer to control on userform from code module Dale Fye Excel Programming 1 September 6th 07 03:14 PM
working hotkey even if any control has focus in userform x taol Excel Programming 3 October 23rd 06 09:12 AM
Code not working when transfered into Userform ExcelMonkey[_190_] Excel Programming 9 February 28th 05 09:31 AM
Using code to create a control on an Excel userform Fred Holmes Excel Programming 1 November 17th 04 09:38 PM
Control code behavior with userform ? steve Excel Programming 0 July 30th 03 05:01 PM


All times are GMT +1. The time now is 07:24 PM.

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

About Us

"It's about Microsoft Excel"