mykal66
03-24-2014, 12:06 PM
Hey everyone.
I often use a form to collect data then write it to the next free row on a summary worksheet without issue. I've just set up a new form used a basic worksheet formatted to look like a form to collect the data but when i try to copy i keep getting a run-time error. Can anyone tell me what i am doing wrong please?
This is the code i have always used to copy form data to worksheet. The comented out line is how i've tried to adjust the code to copy from worksheet rather than form.
Dim lRow As Long
Dim lPart As Long
Dim ws As Worksheet
Dim strFileName As String
Dim dDate As Date
Set ws = Worksheets("Summary")
With ws
.Cells(lRow, 1).Value = Me.txt1.Value
‘.Cells(lRow, 1).Value = Sheets("Form").Range("O6").Value
ActiveWorkbook.Save
'find first empty row in database
lRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
End With
End Sub
I often use a form to collect data then write it to the next free row on a summary worksheet without issue. I've just set up a new form used a basic worksheet formatted to look like a form to collect the data but when i try to copy i keep getting a run-time error. Can anyone tell me what i am doing wrong please?
This is the code i have always used to copy form data to worksheet. The comented out line is how i've tried to adjust the code to copy from worksheet rather than form.
Dim lRow As Long
Dim lPart As Long
Dim ws As Worksheet
Dim strFileName As String
Dim dDate As Date
Set ws = Worksheets("Summary")
With ws
.Cells(lRow, 1).Value = Me.txt1.Value
‘.Cells(lRow, 1).Value = Sheets("Form").Range("O6").Value
ActiveWorkbook.Save
'find first empty row in database
lRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
End With
End Sub