noobie
01-16-2007, 11:45 PM
Hi all :hi: ,
I've been stuck at this for 4 days. Really need your expertise help here.
I'm almost done with this macro. But only one last thing, the values that I got from the userform, does not go to their respective row.
Please Check out my userform code:
Private Sub CommandButton1_Click()
Dim lrow As Long
Dim LastRow As Object
ActiveSheet.Unprotect
With ActiveSheet
lrow = .Range("A" & Rows.Count).End(xlUp).Row + 1
.Range("A1:N10").copy .Range("A" & lrow)
On Error Resume Next
.Range("A" & lrow + 1 & ":N" & lrow + 14).SpecialCells(xlCellTypeConstants, 23).Value = ""
On Error GoTo 0
End With
Set LastRow = Range("a65536").End(xlUp) ' I want this at the first blank row after the heading
LastRow.Offset(1, 0).Value = A.Text
LastRow.Offset(1, 1).Value = B.Text
LastRow.Offset(1, 13).Value = C.Text
MsgBox "Record submitted."
response = MsgBox("Do you want to enter another record?", _
vbYesNo)
If response = vbYes Then
A.Text = ""
B.Text = ""
C.Text = ""
A.SetFocus
Else
Unload UserForm5
End If
ActiveSheet.Protect
End Sub
http://i25.photobucket.com/albums/c72/everscern/AAA-2.jpg
The values i input are found on the last row (155) but i want it placed at row (144)
You could refer to this thread. Wanted to post this there but the question i initally asked has been solved : http://www.vbaexpress.com/forum/showthread.php?t=10991
I've been stuck at this for 4 days. Really need your expertise help here.
I'm almost done with this macro. But only one last thing, the values that I got from the userform, does not go to their respective row.
Please Check out my userform code:
Private Sub CommandButton1_Click()
Dim lrow As Long
Dim LastRow As Object
ActiveSheet.Unprotect
With ActiveSheet
lrow = .Range("A" & Rows.Count).End(xlUp).Row + 1
.Range("A1:N10").copy .Range("A" & lrow)
On Error Resume Next
.Range("A" & lrow + 1 & ":N" & lrow + 14).SpecialCells(xlCellTypeConstants, 23).Value = ""
On Error GoTo 0
End With
Set LastRow = Range("a65536").End(xlUp) ' I want this at the first blank row after the heading
LastRow.Offset(1, 0).Value = A.Text
LastRow.Offset(1, 1).Value = B.Text
LastRow.Offset(1, 13).Value = C.Text
MsgBox "Record submitted."
response = MsgBox("Do you want to enter another record?", _
vbYesNo)
If response = vbYes Then
A.Text = ""
B.Text = ""
C.Text = ""
A.SetFocus
Else
Unload UserForm5
End If
ActiveSheet.Protect
End Sub
http://i25.photobucket.com/albums/c72/everscern/AAA-2.jpg
The values i input are found on the last row (155) but i want it placed at row (144)
You could refer to this thread. Wanted to post this there but the question i initally asked has been solved : http://www.vbaexpress.com/forum/showthread.php?t=10991