How to enter data into two sheets in a workboot from one form

selant

Board Regular
Joined
Mar 26, 2009
Messages
109
I have a form (excel + vba) with some texboxes.
Is it possible to enter the first 3 textboxes data into SHEET1
and the other 3 textboxes data into SHEET2

And finally the workbook will return to SHEET1 back.

I would appreciate a sample code. Thank you:eek:
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
You may want to try something like this, go to VB and right click on the form where the text boxes are and go to view code... may need to adjust/add for text boxes as I only did this for a 3 boxes but you should get the point.

Code:
Private Sub TextBox1_Change()
    Sheets("sheet1").Activate
    Range("A1").Value = TextBox1.Value
End Sub

Private Sub TextBox2_Change()
    Sheets("sheet1").Activate
    Range("B1").Value = TextBox2.Value
End Sub

Private Sub TextBox3_Change()
    Sheets("sheet2").Activate
    Range("A1").Value = TextBox3.Value
    Sheets("sheet1").Activate
End Sub

notice the textbox3 refers back to sheet 1 this may look like it is not updating sheet 2 but it does. let me nkow if this is what you want
 
Upvote 0

Forum statistics

Threads
1,214,517
Messages
6,119,984
Members
448,935
Latest member
ijat

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top