userform

A

~Alan

XL2000
userform code
I entered a new text box in the user for and named it "Textwrknmbr"
in the below code I added ws.Range("bt2").Value = Textwrknmbr and
Textwrknmbr.Value = ""

I need the information to go to "sheet2" bt 2 what am I missing?



Private Sub cmdAdd_Click()
Dim r As Long
Dim ws As Worksheet
Set ws = Worksheets("Parts")

r = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
ws.Range("A" & r).Value = txtPartnumber.Value
ws.Range("B" & r).Value = txtQty.Value
ws.Range("C" & r).Value = txtdescription.Value
ws.Range("d" & r).Value = txtmanufacture.Value
ws.Range("E" & r).Value = txtprice.Value
ws.Range("F" & r).Value = txtunits.Value
ws.Range("bt2").Value = Textwrknmbr

With Worksheets("sheet2")
.Cells(.Rows.Count, "DR").End(xlUp).Offset(1, 0).Value _
= txtPartnumber.Value
End With
End If
txtPartnumber.Value = ""
txtQty.Value = ""
txtdescription.Value = ""
txtmanufacture.Value = ""
txtprice.Value = ""
txtunits.Value = ""
Textwrknmbr.Value = ""
'txtPart.SetFocus

End Sub
 
B

Bob Phillips

This all seems a bit confused. You have an End If and no If, and what is
bt2? Can you explain a bit more please?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
A

~Alan

bt2 is column BT ROW 2

basically i need to know what i need to put in this line
ws.Range("bt2").Value = Textwrknmbr so the info will go
to column BT ROW 2 in "sheet1"

Private Sub cmdAdd_Click()
Dim r As Long
Dim ws As Worksheet

ws.Range("bt2").Value = Textwrknmbr

Textwrknmbr.Value = ""
End Sub
 
B

Bob Phillips

Okay, that is simply

Worksheets("Sheet1").Range(BT2").Value = Textwrknmbr

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

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