PDA

View Full Version : Solved: Add new row to spreadsheet



bopo
01-16-2007, 11:20 AM
Hi people

Right basically each time a user does a certain process, I want information within several text boxes to be stored within a spreadsheet permentely, however I want to be excel to use a new row per process, therefore not overwriting the previous record, how do I do this?
also the information is coming for several UserForms

Bob Phillips
01-16-2007, 11:51 AM
iLastRow = Cells(Rows.Count,"A").End(xlUp).Row + 1
Range("A" & iLastRow).Value = textbox1.Text
'etc.

bopo
01-16-2007, 11:56 AM
iLastRow = Cells(Rows.Count,"A").End(xlUp).Row + 1
Range("A" & iLastRow).Value = textbox1.Text
'etc.

Thanks, however how do I specify which worksheet I want to write to?

as this coding is going behind a button on a userform

Bob Phillips
01-16-2007, 01:40 PM
Thanks, however how do I specify which worksheet I want to write to?

as this coding is going behind a button on a userform



With Worksheets("Sheet1")
iLastRow = .Cells(.Rows.Count,"A").End(xlUp).Row + 1
.Range("A" & iLastRow).Value = Textbox1.Text
'etc.
End With

bopo
01-16-2007, 01:43 PM
thanks :D

Bob Phillips
01-17-2007, 02:34 AM
If you have Option Explicit, iLastRow must be explicitly declared



Dim iLastRow As Long

'rest of code