View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default User form and Command button

hi,
you can try something like this.....
Private Sub CommandButton1_Click()
Dim r As Range
'Set r = Workbooks("Book1").Sheets("Sheet1").Range("A1")
'use this to sent value to same place over and over
Set r = ActiveSheet.Range("A65000").End(xlUp).Offset(1, 0)
'use this if you are creating a database with rows of customers.
r.Value = textbox1.Value 'Set the value on the sheet
textbox1.Value = "" 'clears the form if needed
End Sub

adjust to your stuff. this only works on 1 textbox and one cell. you will
need to add a line and a variable for each textbox on your form.

regards
FSt1

"Marilyn" wrote:

Hello I created a user custom form with the help of Excel 2002 Visual Basic
Book. My problem is that I created 2 command buttons in the user form, one
a cancel button, and that is OK, the other is "Add customer" and that is
where I am having problems, four hours of problem. Once the user form is
completed and the "add customer " button is selected I want the information
to go the the spreahsheet. How to I do this? Thanks