Dear all
I have this code given, it works fine but i need to add 2 more fields
cmb_staff
txt_date
I try to put then in the front as
With ThisWorkbook.Sheets("main")
NextRow = .Cells(Rows.Count, "A").End(xlUp).Row + 1
.Cells(NextRow, 1) = cmb_staff
.Cells(NextRow, 2 = txt_date
.Cells(NextRow, 3 ) = cmb_city
.Cells(NextRow,4) = cmb_nature
However, when i enter the first time, was go to the first row rather then at the last one, 2nd enter it replaced out my record 2nd row record.
How can i fix it
Private Sub Btn_close_Click()
Dim Company As String
Dim NextRow As Long
Company = txt_company
With ThisWorkbook.Sheets("main")
NextRow = .Cells(Rows.Count, "A").End(xlUp).Row + 1
.Cells(NextRow, 1) = cmb_city
.Cells(NextRow, 2) = cmb_nature
.Cells(NextRow, 3) = txt_company
.Cells(NextRow, 4) = txt_contact
.Cells(NextRow, 5) = txt_title
.Cells(NextRow, 6) = txt_tel
.Cells(NextRow, 7) = txt_mail
.Hyperlinks.Add Anchor:=.Cells(NextRow, 7), Address:="Mailto://" & txt_mail
.Hyperlinks.Add Anchor:=.Cells(NextRow, 8), Address:="http://" & txt_web
.Hyperlinks.Add Anchor:=.Cells(NextRow, 9), Address:="http://" & txt_shared
End With
Unload USER
MsgBox Company & " has been added to the Record", 0, "Completed"
End Sub
Appreciated your help
Eric
Bookmarks