ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   User form and Command button (https://www.excelbanter.com/excel-discussion-misc-queries/141902-user-form-command-button.html)

Marilyn

User form and Command button
 
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

FSt1

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


Debra Dalgleish

User form and Command button
 
There are instructions and sample file for a UserForm he

http://www.contextures.com/xlUserForm02.html

The 'Add this part' button sends the information to a worksheet.

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



--
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html


Marilyn

User form and Command button
 
Thank Debra This is perfect.

"Debra Dalgleish" wrote:

There are instructions and sample file for a UserForm he

http://www.contextures.com/xlUserForm02.html

The 'Add this part' button sends the information to a worksheet.

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



--
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html




All times are GMT +1. The time now is 01:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com