Transferring Data from UserForm to Worksheet is very slow!!!

pgreenway

New Member
Joined
Aug 15, 2014
Messages
1
Is is there anything I'm doing that is causing this to be so slow? It takes upwards of a minute to get the data transferred to the worksheet. It really hangs up and I can't figure out why. Any help would be greatly appreciated. Thanks!!!

Code:
'Closes UserForm and returns to Main Menu

Private Sub CommandButton3_Click()


Unload Me
UserForm3.Show


End Sub


'Ensures clicking the X on the top right of screen is disabled


Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)


If CloseMode = 0 Then
    Cancel = True
    MsgBox " The X is diabled, please use a button on the form.", vbCritical, "Disabled button warning!!!"
End If


End Sub


'No Data Entry on this form is saved, proceed to next form


Private Sub CommandButton2_Click()


Unload Me
UserForm1.Show


End Sub


Public Sub UserForm_Initialize()


'Centers the Userform on the screen


With UserForm
 .StartUpPosition = 0
 .Left = Application.Left + (0.5 * Application.Width) - (0.5 * .Width)
 .Top = Application.Top + (0.5 * Application.Height) - (0.5 * .Height)
 '.Show


 End With


'Inserts initial values for all comboboxes on the userform 


Dim i As Long
ComboBox1.List = Array("Pass", "Fail", "No Test")
ComboBox1.Value = "Pass"
ComboBox1.ListIndex = 0


For i = 2 To 52
   Me.Controls("ComboBox" & i).Object.List = ComboBox1.List
   Me.Controls("ComboBox" & i).Object.Value = ComboBox1.Value
   Me.Controls("ComboBox" & i).Object.ListIndex = ComboBox1.ListIndex


Next i


End Sub


'Saves data on this userform and proceeds to next userform for continued data entry


Private Sub CommandButton1_Click()


Dim ssheet As Worksheet


Select Case MsgBox("Are you sure you have all the entries correct?", vbYesNoCancel, "Ensure all entries are correct before proceeding!")


Case Is = vbYes


Sheets("Sheet1").Unprotect Password:="lee"


nr = 4


Set ssheet = ThisWorkbook.Sheets("Sheet1")


For n = 4 To 1000


   If ssheet.Cells(8, n) <> "" Then
       nr = nr + 1
   Else
       Exit For
   End If
Next n




ssheet.Cells(8, nr).Value = Me.ComboBox1.Value
ssheet.Cells(9, nr).Value = Me.ComboBox2.Value
ssheet.Cells(10, nr).Value = Me.ComboBox3.Value
ssheet.Cells(11, nr).Value = Me.ComboBox4.Value
ssheet.Cells(12, nr).Value = Me.ComboBox5.Value
ssheet.Cells(13, nr).Value = Me.ComboBox6.Value
ssheet.Cells(14, nr).Value = Me.ComboBox7.Value
ssheet.Cells(15, nr).Value = Me.ComboBox8.Value


ssheet.Cells(17, nr).Value = Me.ComboBox9.Value
ssheet.Cells(18, nr).Value = Me.ComboBox10.Value
ssheet.Cells(19, nr).Value = Me.ComboBox11.Value
ssheet.Cells(20, nr).Value = Me.ComboBox12.Value
ssheet.Cells(21, nr).Value = Me.ComboBox13.Value
ssheet.Cells(22, nr).Value = Me.ComboBox14.Value
ssheet.Cells(23, nr).Value = Me.ComboBox15.Value
ssheet.Cells(24, nr).Value = Me.ComboBox16.Value
ssheet.Cells(25, nr).Value = Me.ComboBox17.Value
ssheet.Cells(26, nr).Value = Me.ComboBox18.Value
ssheet.Cells(27, nr).Value = Me.ComboBox19.Value
ssheet.Cells(28, nr).Value = Me.ComboBox20.Value
ssheet.Cells(29, nr).Value = Me.ComboBox21.Value
ssheet.Cells(30, nr).Value = Me.ComboBox22.Value


ssheet.Cells(32, nr).Value = Me.ComboBox23.Value
ssheet.Cells(33, nr).Value = Me.ComboBox24.Value
ssheet.Cells(34, nr).Value = Me.ComboBox25.Value
ssheet.Cells(35, nr).Value = Me.ComboBox26.Value
ssheet.Cells(36, nr).Value = Me.ComboBox27.Value
ssheet.Cells(37, nr).Value = Me.ComboBox28.Value
ssheet.Cells(38, nr).Value = Me.ComboBox29.Value


ssheet.Cells(40, nr).Value = Me.ComboBox30.Value


ssheet.Cells(42, nr).Value = Me.ComboBox31.Value


ssheet.Cells(44, nr).Value = Me.ComboBox32.Value
ssheet.Cells(45, nr).Value = Me.ComboBox33.Value
ssheet.Cells(46, nr).Value = Me.ComboBox34.Value
ssheet.Cells(47, nr).Value = Me.ComboBox35.Value
ssheet.Cells(48, nr).Value = Me.ComboBox36.Value
ssheet.Cells(49, nr).Value = Me.ComboBox37.Value
ssheet.Cells(50, nr).Value = Me.ComboBox38.Value
ssheet.Cells(51, nr).Value = Me.ComboBox39.Value
ssheet.Cells(52, nr).Value = Me.ComboBox40.Value
ssheet.Cells(53, nr).Value = Me.ComboBox41.Value
ssheet.Cells(54, nr).Value = Me.ComboBox42.Value
ssheet.Cells(55, nr).Value = Me.ComboBox43.Value
ssheet.Cells(56, nr).Value = Me.ComboBox44.Value
ssheet.Cells(57, nr).Value = Me.ComboBox45.Value
ssheet.Cells(58, nr).Value = Me.ComboBox46.Value
ssheet.Cells(59, nr).Value = Me.ComboBox47.Value
ssheet.Cells(60, nr).Value = Me.ComboBox48.Value
ssheet.Cells(61, nr).Value = Me.ComboBox49.Value
ssheet.Cells(62, nr).Value = Me.ComboBox50.Value
ssheet.Cells(63, nr).Value = Me.ComboBox51.Value
ssheet.Cells(64, nr).Value = Me.ComboBox52.Value




Sheets("Sheet1").Protect Password:="lee"


Application.ScreenUpdating = True
Unload Me
UserForm1.Show
Application.ScreenUpdating = False


Case Is = vbNo
MsgBox "Please double check your entries before proceeding.", vbOKOnly, "Verify your entries and continue!!!"


End Select


End Sub
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Forum statistics

Threads
1,215,450
Messages
6,124,912
Members
449,195
Latest member
Stevenciu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top