Hello all,
I'm creating a training database file in excel. I've got a Create Training Record button and when I click it opens a user form. When I enter data and hit "Add Record" it opens up an explorer window to choose a file from my drives. If I hit cancel it then will allow the information I typed to be added to the table. Any idea why it is launching a open file? I'll clean up co Here is all the code I have:
Lives in Forms:
Private Sub cmdAddRecord_Click()
eRow = Worksheets("TrainingDataBase").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Cells(eRow, 1) = EmpID.Value
Cells(eRow, 2) = TrnType.Value
Cells(eRow, 3) = SubType.Value
Cells(eRow, 4) = DateComp.Value
End Sub
Private Sub cmdExit_Click()
Dim iExit As VbMsgBoxResult
iExit = MsgBox("Confirm if you want to exit", vbQuestion + vbYesNo, "Data Entry Form")
If iExit = vbYes Then
Unload Me
End If
End Sub
Private Sub cmdReset_Click()
EmpID.Text = ""
DateComp.Text = ""
TrnType.Text = ""
SubType.Text = ""
End Sub
Lives in Module 1
Sub CreateTrainingRecord()
'Start Userform Centered inside Excel Screen (for dual monitors)
User_Form.StartUpPosition = 0
User_Form.Left = Application.Left + (0.5 * Application.Width) - (0.5 * User_Form.Width)
User_Form.Top = Application.Top + (0.5 * Application.Height) - (0.5 * User_Form.Height)
User_Form.Show
End Sub
Lives in Module 2
Sub UpdateFormulaButton()
'
' UpdateFormulaButton Macro
Range("F5:L5").Select
Selection.AutoFill Destination:=Range("TrainingTable[[Name]:[Quarter]]")
Range("TrainingTable[[Name]:[Quarter]]").Select
End Sub
I'm creating a training database file in excel. I've got a Create Training Record button and when I click it opens a user form. When I enter data and hit "Add Record" it opens up an explorer window to choose a file from my drives. If I hit cancel it then will allow the information I typed to be added to the table. Any idea why it is launching a open file? I'll clean up co Here is all the code I have:
Lives in Forms:
Private Sub cmdAddRecord_Click()
eRow = Worksheets("TrainingDataBase").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Cells(eRow, 1) = EmpID.Value
Cells(eRow, 2) = TrnType.Value
Cells(eRow, 3) = SubType.Value
Cells(eRow, 4) = DateComp.Value
End Sub
Private Sub cmdExit_Click()
Dim iExit As VbMsgBoxResult
iExit = MsgBox("Confirm if you want to exit", vbQuestion + vbYesNo, "Data Entry Form")
If iExit = vbYes Then
Unload Me
End If
End Sub
Private Sub cmdReset_Click()
EmpID.Text = ""
DateComp.Text = ""
TrnType.Text = ""
SubType.Text = ""
End Sub
Lives in Module 1
Sub CreateTrainingRecord()
'Start Userform Centered inside Excel Screen (for dual monitors)
User_Form.StartUpPosition = 0
User_Form.Left = Application.Left + (0.5 * Application.Width) - (0.5 * User_Form.Width)
User_Form.Top = Application.Top + (0.5 * Application.Height) - (0.5 * User_Form.Height)
User_Form.Show
End Sub
Lives in Module 2
Sub UpdateFormulaButton()
'
' UpdateFormulaButton Macro
Range("F5:L5").Select
Selection.AutoFill Destination:=Range("TrainingTable[[Name]:[Quarter]]")
Range("TrainingTable[[Name]:[Quarter]]").Select
End Sub