I have reviewed the similar posts and none of the recommendations fix my issue. I have a form with several text boxes that I'm trying to write to a sheet (20 lines, 6 cells per line).
It takes about 58 seconds to write this to the sheet but takes a fraction of a second to load the form from the same table. I feel like I've done this before with no issue but this is clunky. Can some one set me on the right path to speed this thing up? Below code is in the form.
It takes about 58 seconds to write this to the sheet but takes a fraction of a second to load the form from the same table. I feel like I've done this before with no issue but this is clunky. Can some one set me on the right path to speed this thing up? Below code is in the form.
Code:
Private Sub cmd_Done_Click()
' Turn stuff off
Application.ScreenUpdating = False
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
' Dims
Dim i As Integer
Dim j As Integer
Dim LastRow As Long
Dim myRow As Long
Dim myPillar(1 To 4) As String
myPillar(1) = "Q"
myPillar(2) = "S"
myPillar(3) = "D"
myPillar(4) = "C"
' Load data from form into sheet
With Sheets("KPI Table")
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For j = 1 To 4
For i = 1 To 5
myRow = Me.Controls("lbl_Row_KPI_" & myPillar(j) & "_" & Format(i, "00"))
.Cells(myRow, 1).Value = "KPI_" & myPillar(j) & "_" & Format(i, "00")
.Cells(myRow, 2).Value = Me.lbl_Date
.Cells(myRow, 3).Value = Mid(Me.lbl_Date, Len(Me.lbl_Date) - 3)
.Cells(myRow, 4).Value = "YrWk"
.Cells(myRow, 5).Value = Me.Controls("tbo_G_KPI_" & myPillar(j) & "_" & Format(i, "00")).Value
.Cells(myRow, 6).Value = Me.Controls("tbo_A_KPI_" & myPillar(j) & "_" & Format(i, "00")).Value
Next i
Next j
End With
' Turn stuff back on
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
Application.ScreenUpdating = True
Unload Me
End Sub