andrewfoss01
New Member
- Joined
- Feb 7, 2021
- Messages
- 2
- Office Version
- 2019
- Platform
- Windows
I have a excel file that is designed for entering drawing numbers to use as a register. The file is design to search a part of the drawing number and relate it to a client # on a different sheet. I want my userform to prompt the user if no return is found relating the newly entered drawing number with a client.
For example; drawing # LN005555-001-SK_0 relates that LN005555 must be client "John Doe"
if no client is found, and returns "#N/A", than a prompt is made to enter new Client information, and activate another userform to enter new client information.
My VBA skills are extremely limited. Who can help me out with this?
The new client entry userform name is called "job_entry"
I'd like to have a custom prompt to say "Please Enter New Job & Client Information"
my code thus far:
For example; drawing # LN005555-001-SK_0 relates that LN005555 must be client "John Doe"
if no client is found, and returns "#N/A", than a prompt is made to enter new Client information, and activate another userform to enter new client information.
My VBA skills are extremely limited. Who can help me out with this?
The new client entry userform name is called "job_entry"
I'd like to have a custom prompt to say "Please Enter New Job & Client Information"
my code thus far:
Code:
Private Sub UserForm_Initialize()
Dim Sht As Worksheet
For Each Sht In Worksheets
If Sht.AutoFilterMode = True Then
Debug.Print Sht.Name
Sht.AutoFilterMode = False
End If
Next
Dim TodaysDate As String
TodaysDate = Format(Now(), "dd/mmm/yyyy")
txt_date_create.Value = TodaysDate
End Sub
Private Sub add_data_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("DWG LIST")
'''find first empty row in database
''iRow = ws.Cells(Rows.Count, 1) _
'' .End(xlUp).Offset(1, 0).Row
iRow = Worksheets("DWG LIST").Range("A1").End(xlDown).Row + 1
'check for a drawing number
If Trim(Me.txt_dwg_num.Value) = "" Then
Me.txt_dwg_num.SetFocus
MsgBox "Please enter a drawing number"
Exit Sub
End If
With ws
.Cells(iRow, 1).Value = Me.txt_dwg_num.Value
.Cells(iRow, 7).Value = Me.txt_date_create.Value
.Cells(iRow, 8).Value = Me.username1.Value
.Cells(iRow, 9).Value = Me.txt_ewp_num.Value
.Cells(iRow, 12).Value = Me.txt_title.Value
End With
'clear the data
Me.txt_dwg_num.Value = ""
Me.txt_ewp_num.Value = ""
Me.txt_title.Value = ""
Me.txt_dwg_num.SetFocus
ActiveSheet.Cells(ActiveSheet.Rows.Count, Selection.Column).End(xlUp).Select
End Sub
Private Sub close_form_Click()
Unload Me
End Sub
Private Sub txt_dwg_num_Change()
txt_dwg_num.Text = UCase(txt_dwg_num.Text)
End Sub
Private Sub username1_Change()
username1.Text = UCase(username1.Text)
End Sub
Private Sub txt_ewp_num_Change()
txt_ewp_num.Text = UCase(txt_ewp_num.Text)
End Sub
Private Sub txt_title_Change()
txt_title.Text = UCase(txt_title.Text)
End Sub