Hey Guys,
I have kinda complicated UserForm and tried to do some tricks with one extra button, but as soon as I have created it and try to press it takes me ages it keeps saying "Calculating" for like one minute before transfering any data to the sheets. Maybe you guys have any idea which of the code lines makes this happen... Thanks in advance!
I have kinda complicated UserForm and tried to do some tricks with one extra button, but as soon as I have created it and try to press it takes me ages it keeps saying "Calculating" for like one minute before transfering any data to the sheets. Maybe you guys have any idea which of the code lines makes this happen... Thanks in advance!
Code:
Private Sub CommandButton1_Click()
Dim emptyRow As Long
'Activates barcode sheet
Worksheets("barcode").Activate
'where the data will be transfered
emptyRow = WorksheetFunction.CountA(Range("B:B")) + 1
If clicked = True Then
GoTo JustPrint
End If
'Data transfer
Cells(emptyRow, 2).Value = DateTextBox.Value
Cells(emptyRow, 3).Value = ClientTextBox.Value
Cells(emptyRow, 4).Value = ComboBox1.Value
Cells(emptyRow, 5).Value = TextBox1.Value
Application.ScreenUpdating = False
Dim LastRow As Long
LastRow = Cells(Rows.Count, "E").End(xlUp).Row
Range("A" & LastRow).Copy Destination:=Range("F1")
Range("A" & LastRow).Copy Destination:=Sheets("Stock").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
Application.ScreenUpdating = True
With Sheets("barcodeprint")
.Range("A1").Value = ClientTextBox.Text
.Range("C4").Value = DateTextBox.Text
.Range("C5").Value = ComboBox1.Value
.Range("C6").Value = TextBox1.Value
'Print
JustPrint:
Sheets("barcodeprint").PrintOut
clicked = True
End With
End Sub