View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Angeliki Angeliki is offline
external usenet poster
 
Posts: 17
Default Define the irownumber

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.