PDA

View Full Version : Solved: Data from Userform to spreadsheet



bopo
01-16-2007, 07:37 AM
Hiya People :hi:


Basically I have a form which users enter info into via text boxes, and selecting lstbox options etc, I want to be able to click a button and tranfer some of this data to specifc cells within a spreadsheet, any ideas on how to do it.

cheers

matthewspatrick
01-16-2007, 07:46 AM
Here is simple code that transfers data to the first empty row in the sheet:



Dim LastR As Long
Dim ws As Worksheet

Set ws = ThisWorkbook.Worksheets("foo")
LastR = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row + 1

Cells(LastR, 1) = Me.Text1
Cells(LastR, 2) = Me.Text2
Cells(LastR, 3) = Me.Text3

bopo
01-16-2007, 08:02 AM
Thanks for info, any idea how to specficy exact cells?

Bob Phillips
01-16-2007, 08:11 AM
That is exact cells, Patrick just works out the next row to place them.

You could also try



Range("A1").Value = Me.Textbox1.Text

Aussiebear
01-17-2007, 04:34 AM
or you could use the offset command to place data in certain cells in a known row and or column once your initial input cell is selected.

Ted