ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,226
- Office Version
- 2007
- Platform
- Windows
Hi,
I have a userform which when i use the command button it should transfer the data to the worksheet.
The code is shown below
I complete the userform & press the command button.
I then see the success message BUT there is nothing on the worksheet.
row 2 is hidden.
What did i miss.
Thanks
Worksheet can be downloaded here.
MOTORCYCLE CLONING TEST.xlsm
I have a userform which when i use the command button it should transfer the data to the worksheet.
The code is shown below
I complete the userform & press the command button.
I then see the success message BUT there is nothing on the worksheet.
row 2 is hidden.
What did i miss.
Thanks
Worksheet can be downloaded here.
MOTORCYCLE CLONING TEST.xlsm
VBA Code:
Private Sub CommandButton1_Click()
Dim i As Long, x As Long
Dim ControlsArr(1 To 8) As Variant, ns As Variant
Application.ScreenUpdating = False
For i = 1 To 8
ControlsArr(i) = Array(TextBox1, Me.ComboBox1, Me.ComboBox2, Me.ComboBox3, Me.ComboBox4, Me.ComboBox5, Me.ComboBox6, Me.ComboBox7)
Next i
With ThisWorkbook.Worksheets("DETAILS")
.Range("B3").EntireRow.Insert Shift:=xlDown
.Range("B3:I3").Borders.Weight = xlThin
.Cells(3, 1).Resize(, UBound(ControlsArr)).Value = ControlsArr
Application.EnableEvents = False
If .AutoFilterMode Then .AutoFilterMode = False
x = .Cells(.Rows.Count, 1).End(xlUp).Row
.Range("A2:I" & x).Sort Key1:=.Range("A3"), Order1:=xlAscending, Header:=xlGuess
End With
ActiveWorkbook.Save
MsgBox "Database Has Been Updated", vbInformation, "SUCCESSFUL MESSAGE"
Application.ScreenUpdating = True
Application.EnableEvents = True
Unload MotorcycleCloningForm
End Sub