Mark_richardson28
New Member
- Joined
- Sep 29, 2006
- Messages
- 36
Hi, if someone could help with this it would be much appreciated.
I have a form box that holds 13 text boxes, which dumps the values into a blank spreadsheet, looking for the next available line. However i havn't managed to get it to reference the values to the next available blank line. It just keeps writing over the last input.
The code i am using is as follows,
Private Sub cmdupdate_Click()
Application.ScreenUpdating = False
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("RawData")
'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
'check for calls
If Trim(Me.txtcalls.Value) = "" Then
Me.txtcalls.SetFocus
Exit Sub
End If
'copy the data to the database
ws.Cells(iRow, 2).Value = Me.txtcalls.Value
'clear the data
Me.txtcalls.Value = ""
Me.txtcalls.SetFocus
It continues on for all text boxes.
Can anyone help with this?
Many thanks
I have a form box that holds 13 text boxes, which dumps the values into a blank spreadsheet, looking for the next available line. However i havn't managed to get it to reference the values to the next available blank line. It just keeps writing over the last input.
The code i am using is as follows,
Private Sub cmdupdate_Click()
Application.ScreenUpdating = False
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("RawData")
'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
'check for calls
If Trim(Me.txtcalls.Value) = "" Then
Me.txtcalls.SetFocus
Exit Sub
End If
'copy the data to the database
ws.Cells(iRow, 2).Value = Me.txtcalls.Value
'clear the data
Me.txtcalls.Value = ""
Me.txtcalls.SetFocus
It continues on for all text boxes.
Can anyone help with this?
Many thanks