Angeliki,
PutData is executing before you set the irownumber variable. I'd also
suggest using a long variable for rows. Integer can fail on a big sheet.
Try it as
Private lRowNumber as long
Private Sub CB1_Click
lRowNumber = range("Database").rows.count +1
PutData
Range("Database).resize etc.
Yours,
Robin Hammond
www.enhanceddatasystems.com
Check out our XspandXL add-in
"Angeliki" wrote in message
...
Option Explicit
Dim iRowNumber As Integer
Private Sub CommandButton1_Click()
Call PutData
Range("DataBase").Resize(Range("Database").Rows.Co unt + 1).Name =
"DataBase"
iRowNumber = Range("DataBase").Rows.Count
Call GetData
TextBox1.SetFocus
End Sub
Sub PutData()
With UserForm2
Range("DataBase").Cells(iRowNumber, 5) = .TextBox1
End With
End Sub
Sub GetData()
With UserForm1
.TextBox1 = Range("DataBase").Cells(iRowNumber, 5)
End With
End Sub
Private Sub CommandButton2_Click()
Unload UserForm2
End Sub
Hello
Altough i defined the irownumber as an integer and as the rows count when
i
ask to put the data into the cell(irownumber,5), debug.
The irownumber sets equal to zero so it cannot find a cell (0,5).
Can you pleaze help me to find out what's wrong
Thanks in advance
Regards
Angeliki
PS. I used the same code for something relevant and it worked.