PASSING DATA FROM USER FORM TO EXCEL SPREADSHEET

B

Bob Phillips

Range("A1").Value = Userform1.TextBox1.Text

as an example. More specific questions might help.

--

HTH

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

Ron de Bruin

You can also place this line in the click event of a button on the userform

ThisWorkbook.Sheets("Sheet1").Range("a1").Value = Me.TextBox1.Value
 
E

EXCELLENT1

You can also place this line in the click event of a button on th
userform

ThisWorkbook.Sheets("Sheet1").Range("a1").Value = Me.TextBox1.Value

That is my intention.

the workbook is called book1 and the worksheet is called sheet1.

column 1 is where I want to place the RGA number.

my userform is called frmRGAInput and the text box on the form for th
RGA number is called txtRGANum

I entered:

Private Sub cmdCommit_Click()

ThisWorkbook.Sheets("Sheet1").Range("a1").Value
frmRGAInput.txtRGANum.Value
End Sub

and it worked, how do I set it up so that every time I click the O
button it enters the data on the next row of the excel sheet
 
G

Guest

You can also place this line in the click event of a
button on the userform

ThisWorkbook.Sheets("Sheet1").Range("a1").Value =
Me.TextBox1.Value

That is my intention.

the workbook is called book1 and the worksheet is called
sheet1.

column 1 is where I want to place the RGA number.

my userform is called frmRGAInput and the text box on the
form for the RGA number is called txtRGANum

I entered:

Private Sub cmdCommit_Click()

ThisWorkbook.Sheets("Sheet1").Range("a1").Value =
frmRGAInput.txtRGANum.Value
End Sub

and it worked, how do I set it up so that every time I
click the OK button it enters the data on the next row of
the excel sheet?

Also, how can i get this specific form to pop up when
Book1 is openned?
 
B

Bob Phillips

Bit different to what you initially asked!

Is This what you want?

Private Sub cmdCommit_Click()

iRow = Cells(Rows.Count, "A").End(xlUp).Row
If iRow = 1 And Range("A1") = "" Then
iRow = 1
Else
iRow = iRow + 1
End If
ThisWorkbook.Sheets("Sheet1").Cells(iRow, "A").Value =
frmRGAInput.txtRGANum.Value

End Sub


--

HTH

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

Guest

Bit different to what you initially asked!

Is This what you want?

Private Sub cmdCommit_Click()

iRow = Cells(Rows.Count, "A").End(xlUp).Row
If iRow = 1 And Range("A1") = "" Then
iRow = 1
Else
iRow = iRow + 1
End If
ThisWorkbook.Sheets("Sheet1").Cells (iRow, "A").Value =
frmRGAInput.txtRGANum.Value

End Sub

Thank you for the response.

Now, going a step further I have 10 fields per record
that I'll be inputing data for. How can I make this work
for each field so that a new row is entered.
 
B

Bob Phillips

--

HTH

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

Bob Phillips

It's being driven by a button. Where does the fields come into it?

--

HTH

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

Guest

-----Original Message-----
It's being driven by a button. Where does the fields
come into it?

for instance,

this is going to be a RGA input form with RGA number,
customer number, date, notes, action taken, etc....fields
on it and I want to pass these fields to a column
(record).
 
Top