Can you advise me of a simple error please

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,890
Office Version
  1. 2007
Platform
  1. 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



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
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
What is wsGRASS, it hasn't been declared, or assigned a value
 
Upvote 0
wsGRASS is the name of the worksheet.
Now im stumped as to what to look / change etc
 
Upvote 0
Glad it's sorted & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,226,114
Messages
6,189,052
Members
453,522
Latest member
Seeker2025

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top