Hi Everyone,
I'm still having problems with a userform I'm trying to generate in excel, here is the code
Private Sub CommandButton1_Click()
End Sub
Private Sub cmdAdd_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Data")
'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
'copy the data to the database
ws.Cells(iRow, 1).Value = Me.txtInitiative.Value
ws.Cells(iRow, 2).Value = Me.txtCurrentstate.Value
ws.Cells(iRow, 3).Value = Me.txtFuturestate.Value
ws.Cells(iRow, 4).Value = Me.txtKeymilestone.Value
ws.Cells(iRow, 5).Value = Me.txtMetricsofsuccess.Value
ws.Cells(iRow, 6).Value = Me.txtLeadadmin.Value
ws.Cells(iRow, 7).Value = Me.txtProjectmngr.Value
'clear the data
Me.txtInitiative.Value = ""
Me.txtCurrentstate.Value = ""
Me.txtFuturestate.Value = ""
Me.txtKeymilestone.Value = ""
Me.txtMetricsofsuccess.Value = ""
Me.txtLeadadmin.Value = ""
Me.txtProjectmngr.Value = ""
Me.txtInitiative.SetFocus
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub UserForm_Click()
End Sub
It enters the data from the form into a sheet called 'data' but really I would like it to generate a new worksheet, change the name to whatever is in the txtInitiative field and dump the data in there any ideas? pleeeeaaasse
I'm still having problems with a userform I'm trying to generate in excel, here is the code
Private Sub CommandButton1_Click()
End Sub
Private Sub cmdAdd_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Data")
'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
'copy the data to the database
ws.Cells(iRow, 1).Value = Me.txtInitiative.Value
ws.Cells(iRow, 2).Value = Me.txtCurrentstate.Value
ws.Cells(iRow, 3).Value = Me.txtFuturestate.Value
ws.Cells(iRow, 4).Value = Me.txtKeymilestone.Value
ws.Cells(iRow, 5).Value = Me.txtMetricsofsuccess.Value
ws.Cells(iRow, 6).Value = Me.txtLeadadmin.Value
ws.Cells(iRow, 7).Value = Me.txtProjectmngr.Value
'clear the data
Me.txtInitiative.Value = ""
Me.txtCurrentstate.Value = ""
Me.txtFuturestate.Value = ""
Me.txtKeymilestone.Value = ""
Me.txtMetricsofsuccess.Value = ""
Me.txtLeadadmin.Value = ""
Me.txtProjectmngr.Value = ""
Me.txtInitiative.SetFocus
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub UserForm_Click()
End Sub
It enters the data from the form into a sheet called 'data' but really I would like it to generate a new worksheet, change the name to whatever is in the txtInitiative field and dump the data in there any ideas? pleeeeaaasse