Making a form post to different worksheets

S

Souljah

Is this possible - only I have a form which I would prefer to keep a
one, with products and customer details, I have separated the two wit
tabs, any idea how i direct the the products tab to the products shee
and customer details to its sheet?

Also, is there a way to generate a 'Autonumber' sort of thing in V
that will be added to their respective sheets - for things such a
customer ID, product code and order number
 
T

Tom Ogilvy

fully specify the destination in your code

Worksheets("Product").Range("A1").Value = Textbox1
Worksheets("Customer").Range("B9").Value = Textbox12

or if you are using control source, include the sheet name.
 
S

Souljah

Where would I do that?

Sorry, I'm literally only a week old in this VB-Excel Stuff
Private Sub chkUKmainland_Change()
If chkUKmainland = True Then
chkBulk.Enabled = True
Else
chkBulk.Enabled = False
chkBulk = False
End If
End Sub

Private Sub cmdCancel_Click()
Unload Me
End Sub

Private Sub cmdClearForm_Click()
Call UserForm_Initialize
End Sub

Private Sub cmdOK_Click()
ActiveWorkbook.Sheets("Customer Details").Activate
Range("A4").Select
Dim i As Long
Dim rng As Range
With Worksheets("Customer Details")
Set rng = .Range(.Range("B5"), .Cells(Rows.Count, 1).End(xlUp))
End With
For i = 1 To rng.Rows.Count
Next i
'' now loop thru each time OK is clicked will go to next empty row''
rng(i, 1).Value = cboTitle.Value
rng(i, 2).Value = txtFirstname.Value
rng(i, 3).Value = txtSurname.Value
rng(i, 4).Value = txtAddress.Value
rng(i, 5).Value = txtPostcode.Value
rng(i, 6).Value = txtCity.Value
rng(i, 7).Value = txtCountry.Value
rng(i, 8).Value = cboType.Value
rng(i, 9).Value = txtCardnumber.Value
rng(i, 10).Value = cboexpmonth.Value
rng(i, 11).Value = cboexpyear.Value
rng(i, 12).Value = txtCardholder.Value
rng(i, 13).Value = txtIssue.Value
If chkUKmainland = True Then
rng(i, 14).Value = "Yes"
Else
rng(i, 14).Value = "No"
End If
If chkBulk = True Then
rng(i, 15).Value = "Yes"
Else
rng(i, 15).Value = "No"
End If
End Sub

Private Sub SpinButton1_Change()
txtQuantity.Text = SpinButton1.Value
End Sub

Private Sub txtQuantity_Change()
NewVal = Val(txtQuantity.Text)
If NewVal >= SpinButton1.Min And _
NewVal <= SpinButton1.Max Then _
SpinButton1.Value = NewVal
End Sub


Private Sub UserForm_Initialize()
With cboTitle
.AddItem "Mr"
.AddItem "Miss"
.AddItem "Mrs"
.AddItem "Master"
.AddItem "Dr"
End With
cboTitle.Value = ""
txtFirstname.Value = ""
txtSurname.Value = ""
txtAddress.Value = ""
txtPostcode.Value = ""
txtCity.Value = ""
txtCountry.Value = ""
With cboType
.AddItem "Visa/Delta/Electron"
.AddItem "MasterCard/EuroCard"
.AddItem "American Express"
.AddItem "Switch/Solo"
End With
cboType.Value = ""
With cboexpmonth
.AddItem "01"
.AddItem "02"
.AddItem "04"
.AddItem "06"
.AddItem "07"
.AddItem "08"
.AddItem "09"
.AddItem "10"
.AddItem "11"
.AddItem "12"
End With
cboexpmonth.Value = ""
cboexpyear.Value = ""
With cboexpyear
.AddItem "2004"
.AddItem "2005"
.AddItem "2006"
.AddItem "2007"
.AddItem "2008"
.AddItem "2009"
End With
cboexpmonth.Value = ""

chkUKmainland = False
chkBulk = False
cboTitle.SetFocus
End Sub

Heres my code, Say I wanted to make the value of what
"txtQuantity.Text" appear in 'Products' but not in 'customers'
 

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

Top