append data from text box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a text box tb1 on sheet1 that contains a customer name. I would like
tb1 to update the value of cell a1 on sheet2 with the customer name. In
addition I would like to append the data each time the customer name is
changed within the text box. So if sheet2 a1 already contains a value then
sheet2 a2 and so on. Would it be possible to put this in a function called
from a command button that would only update the information when the command
button is selected and also deleted the contents of the text box after the
update? I know this would be easily done in an access db but the employees I
am creating this for do not have licenses to use it. Thanks for any help.
 
Sub AddCustomer
if Range("A1") = "" then
Range("A1") = tb1.Value
Else
Range("A" & Rows.Count).End(xlUp).Offset(1,0) = tb1.Value
End If
End Sub

Add the Command Button from the forms toolbar, then choose this macro
(AddCustomer) to be ran when clicked

Die_Another_Day
 
If the text box and cell reference are on different sheets how does this
affect the sub?
 
Sub AddCustomer()
If Sheets("Sheet2").Range("A1") = "" Then
Sheets("Sheet2").Range("A1") = Sheets("Sheet1").tb1.Value
Else
Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 0) =
Sheets("Sheet1").tb1.Value
End If
End Sub

Try that.

Die_Another_Day
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top