ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,738
- Office Version
- 2007
- Platform
- Windows
Evening,
I copied a working code from one sheet to another,
I then edited sheet name etc.
I enter the data in the userform & press the command Button.
The transfer does not go ahead but i see an error message, Run time error 424 object required.
The code for the button is shown below & the code that is shown in yellow is also supplied below.
Please can you advise why i see this ?
Thanks
I copied a working code from one sheet to another,
I then edited sheet name etc.
I enter the data in the userform & press the command Button.
The transfer does not go ahead but i see an error message, Run time error 424 object required.
The code for the button is shown below & the code that is shown in yellow is also supplied below.
Please can you advise why i see this ?
Thanks
Code:
Private Sub CommandButton2_Click() Dim i As Integer
Dim LastRow As Long
Dim wsLOCKSMITH As Worksheet
Set wsLOCKSMITH = ThisWorkbook.Worksheets("GRASS")
For i = 1 To 6
With Me.Controls("TextBox" & i)
If .Text = "" Then
MsgBox Choose(i, "Name", "Company Name", "Telephone Number", _
"Post Code", "Area", "Country") & _
" Not Entered", vbCritical, "LOCKSMITH INFO SHEET"
.SetFocus
Exit Sub
End If
End With
Next i
With wsGRASS
LastRow = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
End With
For i = 1 To 6
With Me.Controls("TextBox" & i)
wsGRASS.Cells(LastRow, i * 2).Value = .Text
.Text = ""
End With
Next i
MsgBox "GRASS SHEET UPDATED", vbInformation, "GRASS CUTTING SHEET"
TextBox1.SetFocus
End Sub
Code:
LastRow = .Cells(.Rows.Count, 2).End(xlUp).Row + 1