Method 'Default' Error Trap

dkendall

New Member
Joined
Dec 16, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
I've been fighting with this now for days, have re-written the code in every way possible. It's a simple user form that I am trying to have submit individual records to a table on a worksheet in the workbook. It works fine for the first record but fails every time on the second. I've included the errors as well as the code and would really appreciate any help...

1734359785028.png


1734360335803.png



1734360108665.png
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
try this
VBA Code:
Private Sub Submit_Click()
    Dim sh As Worksheet
    Dim iRow As Long
    
Set sh = ThisWorkbook.Sheets("database")

With sh

    iRow = .Range("B" & .Rows.Count).End(xlUp).Row + 1
    
    .Cells(iRow, 2) = Me.cmbName.Value
    .Cells(iRow, 3) = Me.cmbMGR.Value
    .Cells(iRow, 4) = Me.txtDate.Value
    .Cells(iRow, 5) = Me.txtCall.Value
    .Cells(iRow, 6) = Me.txtScore.Value
    .Cells(iRow, 7) = Me.cmbDept.Value
    .Cells(iRow, 8) = Me.cmbRoot.Value
    If Me.optAction = True Then .Cells(iRow, 9) = "Coaching Required"
    .Cells(iRow, 10) = Me.cmbLevel.Value
    .Cells(iRow, 11) = Me.txtFB.Value
    .Cells(iRow, 12) = Application.UserName
    .Cells(iRow, 13) = Format(Now, "MM/DD/YY")
    
End With

End Sub
 
Upvote 0
Hi,
getting that error I would hazard a guess that you have linked one or more of your comboboxes to the table using RowSource property?
If this is so, clear the RowSource property & populate your comboboxes using List property of the control.

Dave
 
Upvote 0

Forum statistics

Threads
1,226,115
Messages
6,189,053
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