ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,738
- Office Version
- 2007
- Platform
- Windows
Hi,
The code supplied below transfers the input data from my userform to my worksheet.
My worksheet is currently A4:F64
I have this code below on a button that sorts the worksheet in column A from A-Z
I would like but not sure how to include the sort function into the code supplied above.
So after the data is transfered to my worksheet it will then sort A-Z for me.
Many Thanks if you could advise please.
The code supplied below transfers the input data from my userform to my worksheet.
Code:
Private Sub CommandButton1_Click() Dim i As Integer
Dim ControlsArr As Variant, ctrl As Variant
For i = 1 To 6
With Me.Controls("ComboBox" & i)
If .ListIndex = -1 Then
MsgBox "MUST SELECT ALL OPTIONS", 48, "CLONING TRANSFER SHEET"
.SetFocus
Exit Sub
End If
End With
Next i
ControlsArr = Array(Me.ComboBox1, Me.ComboBox2, Me.ComboBox3, Me.ComboBox4, Me.ComboBox5, Me.ComboBox6)
With ThisWorkbook.Worksheets("CLONING")
.Range("D4").EntireRow.Insert Shift:=xlDown
.Range("D4:I4").Borders.Weight = xlThin
.Range("D4:I4").Value = ControlsArr
End With
For Each ctrl In ControlsArr
ctrl.Text = ""
Next
MsgBox "Database Has Been Updated", vbInformation, "SUCCESSFUL MESSAGE"
Me.ComboBox1.SetFocus
End Sub
My worksheet is currently A4:F64
I have this code below on a button that sorts the worksheet in column A from A-Z
I would like but not sure how to include the sort function into the code supplied above.
So after the data is transfered to my worksheet it will then sort A-Z for me.
Code:
Private Sub ImmoCarButton_Click()
Dim x As Long
Application.ScreenUpdating = False
With Sheets("SKPLIST")
If .AutoFilterMode Then .AutoFilterMode = False
x = .Cells(.Rows.Count, 1).End(xlUp).Row
.Range("A3:F" & x).Sort key1:=Range("A4"), order1:=xlAscending, Header:=xlGuess
End With
ActiveWorkbook.Save
Application.ScreenUpdating = True
Sheets("SKPLIST").Range("A4").Select
End Sub
Many Thanks if you could advise please.