Hi. I have this code below but i'm getting "Could not find the specified object" (error on Me.Controls)
please help. thanks
Private Sub CommandButton1_Click()
Dim i As Long
Dim LastRow As Object
For i = 0 To 21
Set LastRow = Sheet4.Range("a65536").End(xlUp)
LastRow.Offset(1, 0).Value = sino.Value
LastRow.Offset(1, 1).Value = brgyname.Value
LastRow.Offset(1, 2).Value = tin.Value
LastRow.Offset(1, 3).Value = address.Value
LastRow.Offset(1, 4).Value = sidate.Value
LastRow.Offset(1, 5).Value = Me.Controls("qt" & i).Value
LastRow.Offset(1, 6).Value = Me.Controls("unit" & i).Value
LastRow.Offset(1, 7).Value = Me.Controls("desc" & i).Value
LastRow.Offset(1, 8).Value = Me.Controls("up" & i).Value
LastRow.Offset(1, 9).Value = Me.Controls("amt" & i).Value
Next i
End Sub
please help. thanks
Private Sub CommandButton1_Click()
Dim i As Long
Dim LastRow As Object
For i = 0 To 21
Set LastRow = Sheet4.Range("a65536").End(xlUp)
LastRow.Offset(1, 0).Value = sino.Value
LastRow.Offset(1, 1).Value = brgyname.Value
LastRow.Offset(1, 2).Value = tin.Value
LastRow.Offset(1, 3).Value = address.Value
LastRow.Offset(1, 4).Value = sidate.Value
LastRow.Offset(1, 5).Value = Me.Controls("qt" & i).Value
LastRow.Offset(1, 6).Value = Me.Controls("unit" & i).Value
LastRow.Offset(1, 7).Value = Me.Controls("desc" & i).Value
LastRow.Offset(1, 8).Value = Me.Controls("up" & i).Value
LastRow.Offset(1, 9).Value = Me.Controls("amt" & i).Value
Next i
End Sub