johnbird1988
Board Regular
- Joined
- Oct 6, 2009
- Messages
- 199
Hello
I have the below colde that will look for the next blank row and insert it the vaule of my user form. I would like to use this the other way round and look for the next blabk column in column a and inseart the values in the user form.
Can some please help with changing the code. I have been trying and keep getting errors.
Thank you
John
I have the below colde that will look for the next blank row and insert it the vaule of my user form. I would like to use this the other way round and look for the next blabk column in column a and inseart the values in the user form.
Can some please help with changing the code. I have been trying and keep getting errors.
Thank you
John
Code:
Application.ScreenUpdating = False
Dim lRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Matrix")
lRow = ws.Cells(Rows.count, 1) _
.End(xlUp).Offset(1, 0).Row
If Trim(Me.TextBox4.Value) = "" Or Trim(Me.TextBox3.Value) = "" Or Trim(Me.TextBox1.Value) = "" Or Me.ComboBox1 = "" Or Me.ComboBox2 = "" Then
Me.TextBox4.SetFocus
MsgBox "Please complete all the fields (Employee End Date is Optional)"
Exit Sub
End If
With ws
.Cells(lRow, 1).Value = Me.TextBox4.Value
.Cells(lRow, 2).Value = Me.TextBox3.Value
.Cells(lRow, 3).Value = Me.ComboBox1.Value
.Cells(lRow, 4).Value = Me.ComboBox2.Value
.Cells(lRow, 5).Value = Me.TextBox1.Value
.Cells(lRow, 6).Value = Me.TextBox2.Value
End With
Unload New_Employee
Application.ScreenUpdating = True