S
Scott Rowe
Howdy,
I am trying to minulipate this worksheet so once I enter data into the form
I would like to display the data for each form into a specific cell and then
be able to print each worksheet seperatly.
Example I enter the 14 bits of information and click the button and each
time I enter the info it populates 14 seperate cells on a new worksheet.
then I would like to be able to print each work sheet completly with one
click of a print button.
Can anyone point me in the right direction as these formulas are like a new
language to me and I really can't get the picture. I was able to find some
macros on the web and minulipate them to this poit to meet my needs.
Private Sub cmdAdd_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("PartsData")
'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
'check for a part number
If Trim(Me.txtUIC.Value) = "" Then
Me.txtUIC.SetFocus
MsgBox "Please enter The Equipment Control Data"
Exit Sub
End If
'copy the data to the database
ws.Cells(iRow, 1).Value = Me.txtUIC.Value
ws.Cells(iRow, 2).Value = Me.txtNIIN.Value
ws.Cells(iRow, 3).Value = Me.txtYr_MFG.Value
ws.Cells(iRow, 4).Value = Me.txtFSC.Value
ws.Cells(iRow, 5).Value = Me.TxtGL_CD.Value
ws.Cells(iRow, 6).Value = Me.TxtStatus.Value
ws.Cells(iRow, 7).Value = Me.TxtTrans_CD.Value
ws.Cells(iRow, 8).Value = Me.TxtMFG_CD.Value
ws.Cells(iRow, 9).Value = Me.TxtReg_NUM.Value
ws.Cells(iRow, 10).Value = Me.TxtUTIL_CD.Value
ws.Cells(iRow, 11).Value = Me.TxtSERIAL_NUM.Value
ws.Cells(iRow, 12).Value = Me.TxtCONTR_NUM.Value
ws.Cells(iRow, 13).Value = Me.TxtUPDT_BY.Value
ws.Cells(iRow, 14).Value = Me.TxtDT_TRANS.Value
'clear the data
Me.txtUIC.Value = ""
Me.txtNIIN.Value = ""
Me.txtYr_MFG.Value = ""
Me.txtFSC.Value = ""
Me.TxtGL_CD.Value = ""
Me.TxtStatus.Value = ""
Me.TxtTrans_CD.Value = ""
Me.TxtMFG_CD.Value = ""
Me.TxtReg_NUM.Value = ""
Me.TxtUTIL_CD.Value = ""
Me.TxtSERIAL_NUM.Value = ""
Me.TxtCONTR_NUM.Value = ""
Me.TxtUPDT_BY.Value = ""
Me.TxtDT_TRANS.Value = ""
Me.txtUIC.SetFocus
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, _
CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
MsgBox "Please use the button!"
End If
End Sub
Thanks,
Scott
I am trying to minulipate this worksheet so once I enter data into the form
I would like to display the data for each form into a specific cell and then
be able to print each worksheet seperatly.
Example I enter the 14 bits of information and click the button and each
time I enter the info it populates 14 seperate cells on a new worksheet.
then I would like to be able to print each work sheet completly with one
click of a print button.
Can anyone point me in the right direction as these formulas are like a new
language to me and I really can't get the picture. I was able to find some
macros on the web and minulipate them to this poit to meet my needs.
Private Sub cmdAdd_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("PartsData")
'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
'check for a part number
If Trim(Me.txtUIC.Value) = "" Then
Me.txtUIC.SetFocus
MsgBox "Please enter The Equipment Control Data"
Exit Sub
End If
'copy the data to the database
ws.Cells(iRow, 1).Value = Me.txtUIC.Value
ws.Cells(iRow, 2).Value = Me.txtNIIN.Value
ws.Cells(iRow, 3).Value = Me.txtYr_MFG.Value
ws.Cells(iRow, 4).Value = Me.txtFSC.Value
ws.Cells(iRow, 5).Value = Me.TxtGL_CD.Value
ws.Cells(iRow, 6).Value = Me.TxtStatus.Value
ws.Cells(iRow, 7).Value = Me.TxtTrans_CD.Value
ws.Cells(iRow, 8).Value = Me.TxtMFG_CD.Value
ws.Cells(iRow, 9).Value = Me.TxtReg_NUM.Value
ws.Cells(iRow, 10).Value = Me.TxtUTIL_CD.Value
ws.Cells(iRow, 11).Value = Me.TxtSERIAL_NUM.Value
ws.Cells(iRow, 12).Value = Me.TxtCONTR_NUM.Value
ws.Cells(iRow, 13).Value = Me.TxtUPDT_BY.Value
ws.Cells(iRow, 14).Value = Me.TxtDT_TRANS.Value
'clear the data
Me.txtUIC.Value = ""
Me.txtNIIN.Value = ""
Me.txtYr_MFG.Value = ""
Me.txtFSC.Value = ""
Me.TxtGL_CD.Value = ""
Me.TxtStatus.Value = ""
Me.TxtTrans_CD.Value = ""
Me.TxtMFG_CD.Value = ""
Me.TxtReg_NUM.Value = ""
Me.TxtUTIL_CD.Value = ""
Me.TxtSERIAL_NUM.Value = ""
Me.TxtCONTR_NUM.Value = ""
Me.TxtUPDT_BY.Value = ""
Me.TxtDT_TRANS.Value = ""
Me.txtUIC.SetFocus
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, _
CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
MsgBox "Please use the button!"
End If
End Sub
Thanks,
Scott