Pookiemeister
Well-known Member
- Joined
- Jan 6, 2012
- Messages
- 626
- Office Version
- 365
- 2010
- Platform
- Windows
Code:
Private Sub cmdbtnSubmit_Click() Dim myWrkBk As Workbook
Dim mySheet As Worksheet
Dim textValUp As Integer
Dim textValDown As Integer
Dim numLenA As Integer
Dim numLenF As Integer
Dim startNum As Integer
textValUp = (CInt(txtbxdz.Value) / txtDz / txtCs) + 0.5 - 1E-16
textValDown = (CInt(txtbxdz.Value) / txtDz / txtCs) - 0.5 + 1E-16
startNum = 1
Set myWrkBk = ActiveWorkbook
Set mySheet = myWrkBk.Sheets("Finished Goods Summary")
Do
If textValUp >= 30 Then
numLenA = 30
Else
numLenA = textValUp
End If
If textvaldwn >= 30 Then
numLenF = 30
Else
numLenF = textValDown
End If
With mySheet
.Range("A9:A38").ClearContents
.Range("E9:E38").ClearContents
.Range("F9:F38").ClearContents
.Range("G9:I38").ClearContents
.Range("J9:K38").ClearContents
If numLenA > 0 Then
.Cells(9, "A") = startNum
.Range(.Cells(9, "A"), .Cells(numLenA + 8, "A")).DataSeries Rowcol:=xlColumns, Type:=xlLinear, Step:=1
.Range(.Cells(9, "E"), .Cells(numLenA + 8, "E")).Value = txtUOM
.Range(.Cells(9, "G"), .Cells(numLenA + 8, "G")).Value = txtDz
End If
If numLenF > 0 Then
.Range(.Cells(9, "F"), .Cells(numLenF + 8, "F")).Value = txtCs
.Range(.Cells(9, "J"), .Cells(numLenF + 8, "J")).Value = txtCs * txtDz
End If
End With
textValUp = textValUp - 30
textValDown = textValDown - 30
startNum = startNum + 30
Loop While textValUp > 0
End Sub
Code:
Private Sub cmdbtnPrint_Click()
Call IncrementPrint
End Sub
Code:
'Courtesy of www.extendoffice.com
Sub IncrementPrint()
Dim xCount As Variant
Dim xScreen As Boolean
Dim I As Long
On Error Resume Next
lInput:
' xCount = Application.InputBox("Please enter the number of Copies you want to print:", "Chattem Form")
If TypeName(xCount) = "Boolean" Then Exit Sub
If (xCount = "") Or (Not IsNumeric(xCount)) Or (xCount < 1) Then
MsgBox "Error Entered, Please enter again", vbInformation, "Chattem Error Form"
GoTo lInput
Else
xScreen = Application.ScreenUpdating
Application.ScreenUpdating = False
For I = 1 To xCount
Range("'Placard'!$E$10").Value = I
Sheets("Placard").PrintOut
'ActiveSheet.Range("'Placard'!$E$10").Value = I
'ActiveSheet.PrintOut
Next
ActiveSheet.Range("'Placard'!$E$10").ClearContents
Application.ScreenUpdating = xScreen
End If
If textVal > 0 Then
Sheets("Finished Goods Summary").PrintOut Copies:=1
End If
Application.Quit
End Sub