S
Sue
Hi All
I have a userform with first of all four text boxes that enter a customers
details on a sheet no problem see code below. We sell 24 items and have 24
textboxes in 3 rows of 8 e.g. Tb4 thru Tb11 / Tb12 thru Tb19 / Tb20 thru Tb27
.. I would like to put them all on the command button Add1 and for them all to
enter on 3 separate rows Tb4:Tb11 on one row starting at Col "D" / Tb12:Tb19
on the next row starting at Col "D" / Tb20:Tb27 on the next row starting at
Col "D"
We then hopefully have another customer his / her details are added to the
next rows and so on. If any of the 24 Tboxes have nothing entered the vba
should still run as normal.
Private Sub Add1_Click()
Dim ws As Worksheet
Set ws = Worksheets("New")
startrownum = 2
endrownum = 200
For rownum = startrownum To endrownum
If Trim(Sheets("New").Range("A" & Trim(Str(rownum)))) = "" Then
freerownum = rownum
rownum = endrownum
End If
Next rownum
ws.Cells(freerownum, 1).Value = " " & Trim(UserForm1.Tb1.Value) + " " &
Trim(UserForm1.Tb2.Value)
ws.Cells(freerownum, 2).Value = Tb1A.Value
ws.Cells(freerownum, 3).Value = Tb2A.Value
I have a userform with first of all four text boxes that enter a customers
details on a sheet no problem see code below. We sell 24 items and have 24
textboxes in 3 rows of 8 e.g. Tb4 thru Tb11 / Tb12 thru Tb19 / Tb20 thru Tb27
.. I would like to put them all on the command button Add1 and for them all to
enter on 3 separate rows Tb4:Tb11 on one row starting at Col "D" / Tb12:Tb19
on the next row starting at Col "D" / Tb20:Tb27 on the next row starting at
Col "D"
We then hopefully have another customer his / her details are added to the
next rows and so on. If any of the 24 Tboxes have nothing entered the vba
should still run as normal.
Private Sub Add1_Click()
Dim ws As Worksheet
Set ws = Worksheets("New")
startrownum = 2
endrownum = 200
For rownum = startrownum To endrownum
If Trim(Sheets("New").Range("A" & Trim(Str(rownum)))) = "" Then
freerownum = rownum
rownum = endrownum
End If
Next rownum
ws.Cells(freerownum, 1).Value = " " & Trim(UserForm1.Tb1.Value) + " " &
Trim(UserForm1.Tb2.Value)
ws.Cells(freerownum, 2).Value = Tb1A.Value
ws.Cells(freerownum, 3).Value = Tb2A.Value