Hi,
I have a user form which outputs 4 piece of data in the same row,
ever time there is a break down i want to add another row of data however not override the line just entered, can you provide some help.
Printable View
Hi,
I have a user form which outputs 4 piece of data in the same row,
ever time there is a break down i want to add another row of data however not override the line just entered, can you provide some help.
Code:Option Explicit
Private Sub btnCancel_Click()
Unload Me
End Sub
Private Sub btnOK_Click()
Dim ws As Worksheet
Set ws = ActiveSheet
Dim newRow As Long
newRow = Application.WorksheetFunction.CountA(ws.Range("A:A")) + 1
'The next two lines can be expanded as many times as needed for all the entry fields in your project
ws.Cells(newRow, 1).Value = Me.txtFirstName.Value
ws.Cells(newRow, 2).Value = Me.txtSurname.Value
End Sub
Sub CommandButton1_Click()
Selection.EntireRow.Delete
End Sub
Thanks mate, pretty much covered it, what about if i wanted to start that list at cell d7?
.
Code:Option Explicit
Private Sub btnCancel_Click()
Unload Me
End Sub
Private Sub btnOK_Click()
Dim ws As Worksheet
Set ws = ActiveSheet
Dim newRow As Long
newRow = Application.WorksheetFunction.CountA(ws.Range("D:D")) + 1
'The next two lines can be expanded as many times as needed for all the entry fields in your project
ws.Cells(newRow, 4).Value = Me.txtFirstName.Value
ws.Cells(newRow, 5).Value = Me.txtSurname.Value
End Sub
Sub CommandButton1_Click()
Selection.EntireRow.Delete
End Sub
Do you guys ever use the search function in this Forum ?
Code:Private Sub btnOK_Click()
cells(rows.count,4).end(xlup).offset(1).resize(,4)=array(txtFirstName,txtSurName,"snb","much simpler")
End Sub