Hey guys,
I have created a userform with a few text boxes to be populated into a a series of fields. The idea is that when you press ENTER, the fields are populated into a series of fields in Sheet1 (In row 4, columns C through I). The code I have works when I test it in the VBA viewer, but when I exit the viewer and try it from the sheet, it doesnt work.
The way it works:
1) You go to Sheet1 and press the "Enter New Deal" button which opens up the user form.
Here's the code for this button.
Sub OpenForm()
'
Dim ABC As New UserForm1
ABC.Show
End Sub
2) You enter in the relevant information in the user form. Press Enter.
The ENTER button creates a new row in Row 4 and populates the fields in row 4, columms C through I.
Here's the code for the ENTER button.
Private Sub CommandButton1_Click()
Sheets("Sheet1").Select
Rows("4:4").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Range("C4") = UserForm1.TextBox1.Value
Range("D4") = UserForm1.TextBox9.Value
Range("E4") = UserForm1.TextBox2.Value
Range("F4") = UserForm1.TextBox7.Value
Range("G4") = UserForm1.TextBox6.Value
Range("H4") = UserForm1.ComboBox2.Value
Range("I4") = UserForm1.ComboBox3.Value
Range("J4") = UserForm1.TextBox8.Value
End Sub
This seems to work when I test it in the VBA viewer, but when i try it throught the spreadsheet, nothing populates in the designated fields. Not sure where or what the disconnect is.
Let me know if this doesnt make sense. Thanks in advance.
Bookmarks