Hello,
I am looking to make a code work in the way that it finds the last available empty row in columns A to L since M will have data pull with a formula. But I am not sure how to or where to add the range to make it work. Can I please ave your help?
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("PCARDatabase")
iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
If Trim(Me.TextBox1.Value) = "" Then
Me.TextBox1.SetFocus
Exit Sub
End If
With ws
' .Unprotect Password:="password"
.Cells(iRow, 1).Value = Me.TextBox1.Value
.Cells(iRow, 2).Value = Me.TextBox17.Value
.Cells(iRow, 3).Value = Me.ComboBox2.Value
.Cells(iRow, 4).Value = Me.TextBox2.Value
.Cells(iRow, 5).Value = Me.TextBox3.Value
.Cells(iRow, 6).Value = Me.TextBox4.Value
.Cells(iRow, 7).Value = Me.TextBox5.Value
.Cells(iRow, 8).Value = Me.TextBox6.Value
.Cells(iRow, 9).Value = Me.TextBox8.Value
.Cells(iRow, 10).Value = Me.TextBox9.Value
.Cells(iRow, 11).Value = Me.TextBox10.Value
.Cells(iRow, 12).Value = Me.ComboBox1.Value
' .Protect Password:="password"
Thank you.
I am looking to make a code work in the way that it finds the last available empty row in columns A to L since M will have data pull with a formula. But I am not sure how to or where to add the range to make it work. Can I please ave your help?
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("PCARDatabase")
iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
If Trim(Me.TextBox1.Value) = "" Then
Me.TextBox1.SetFocus
Exit Sub
End If
With ws
' .Unprotect Password:="password"
.Cells(iRow, 1).Value = Me.TextBox1.Value
.Cells(iRow, 2).Value = Me.TextBox17.Value
.Cells(iRow, 3).Value = Me.ComboBox2.Value
.Cells(iRow, 4).Value = Me.TextBox2.Value
.Cells(iRow, 5).Value = Me.TextBox3.Value
.Cells(iRow, 6).Value = Me.TextBox4.Value
.Cells(iRow, 7).Value = Me.TextBox5.Value
.Cells(iRow, 8).Value = Me.TextBox6.Value
.Cells(iRow, 9).Value = Me.TextBox8.Value
.Cells(iRow, 10).Value = Me.TextBox9.Value
.Cells(iRow, 11).Value = Me.TextBox10.Value
.Cells(iRow, 12).Value = Me.ComboBox1.Value
' .Protect Password:="password"
Thank you.