ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Saving from form into multiple sheets (https://www.excelbanter.com/excel-programming/302208-saving-form-into-multiple-sheets.html)

ryssa[_2_]

Saving from form into multiple sheets
 
I have built a form to enter data from. I have two sheets, “Customers
and “Projects”.
Some fields are duplicated in both sheets.

How do I activate both sheets?
How do I make Customer data be saved into "Customers" sheet an
Projects data be saved into "Projects" sheet?
How do I ensure that the data of the duplicated fields are saved int
both sheets?

Thank you very much

--
Message posted from http://www.ExcelForum.com


David Adamson[_3_]

Saving from form into multiple sheets
 
Just change the range to where you want the data to go on the appropriate
sheet


Worksheets("Customers").range("a3") = control(whatever you are calling the
thing you enter datainto)
Worksheets("Projects"),rang("b3")=control(whatever you are calling the thing
you enter datainto)

If you are dealing with a lot of data then you are better setting up a loop
to paste the data back into the spreadsheets



"ryssa " wrote in message
...
I have built a form to enter data from. I have two sheets, "Customers"
and "Projects".
Some fields are duplicated in both sheets.

How do I activate both sheets?
How do I make Customer data be saved into "Customers" sheet and
Projects data be saved into "Projects" sheet?
How do I ensure that the data of the duplicated fields are saved into
both sheets?

Thank you very much.


---
Message posted from http://www.ExcelForum.com/




ryssa[_3_]

Saving from form into multiple sheets
 
Thank you David, though I am not a programmer and Im not sure what to do
with that. Here is what my code looks like.

Private Sub cmdSave_Click()

ActiveWorkbook.Sheets("Contacts").Activate
Range("A1").Select

Do

If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If

Loop Until IsEmpty(ActiveCell) = True

ActiveCell.Value = txtName.Value
ActiveCell.Offset(0, 2) = txtCompany.Value
ActiveCell.Offset(0, 3) = txtAddress.Value
ActiveCell.Offset(0, 4) = txtPhone.Value

ActiveCell.Offset(0, 13) = txtProject.Value
ActiveCell.Offset(0, 10) = cboIndustry.Value
ActiveCell.Offset(0, 15) = cboPersonInCharge.Value

End Sub

In "Customers" sheet I am supposed to save the data
Name, Company, Address, Phone

In "Projects" sheet I am supposed to save the data
Project, Company, Name,
Industry, Person In Charge

Though in reality I have many more that just those fields.


---
Message posted from http://www.ExcelForum.com/



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

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