ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,737
- Office Version
- 2007
- Platform
- Windows
I am using the code below.
I run the command button to send userform values to worksheet BUT no values get intered on the worksheet at all.
I also get no RTE
Do you maybe see why ?
Thanks
I run the command button to send userform values to worksheet BUT no values get intered on the worksheet at all.
I also get no RTE
Do you maybe see why ?
Thanks
Rich (BB code):
Private Sub CommandButton1_Click()
Dim i As Integer
Dim lastRow As Long
Dim wsGIncome As Worksheet
Dim arr(1 To 5) As Variant
Dim Prompt As String
Set wsGIncome = ThisWorkbook.Worksheets("G INCOME")
If ComboBox1.Value = "" Or TextBox2.Value = "" Or _
TextBox3.Value = "" Or TextBox4.Value = "" Or TextBox5.Value = "" Then
MsgBox "YOU MUST COMPLETE ALL THE FIELDS", vbCritical, "USERFORM FIELDS EMPTY MESSAGE"
Exit Sub
End If
Application.ScreenUpdating = False
With wsGIncome
lastRow = .Cells(.Rows.Count, "N").End(xlUp).Row + 1
With .Cells(lastRow, 14).Resize(, UBound(arr))
.Value = arr
.Font.Name = "Calibri"
.Font.Size = 11
.Font.Bold = True
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Borders.Weight = xlThin
.Interior.ColorIndex = 6
.Cells(1, 1).HorizontalAlignment = xlLeft
End With
.Range("N4").Select
End With
Unload Me
Application.ScreenUpdating = True
ActiveSheet.Sort.SortFields.Clear
ActiveSheet.Sort.SortFields.Add Key:=Range("N1"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveSheet.Sort
.SetRange Range("N4:S38")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
MsgBox "DATABASE SUCCESSFULLY UPDATED", vbInformation, "GRASS INCOME NAME & ADDRESS MESSAGE"
End With
End Sub