Getting run-time error using User Form

Livin404

Well-known Member
Joined
Jan 7, 2019
Messages
774
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Greetings,

I think I've gotten closer; however I'm getting a "run time error" followed by a long number. In the same error messge box I get "Method 'Value' of object out of 'Range' failed.

I changed the first column to a Custom Format to a "dd mmm yy". I have a Header Row in Row 1. I have a total 6 columns, but only the first five I need the User Form for. The last column is just the day of the month. (For a Pivot Table).

VBA Code:
Sub Submit()

Dim sh As Worksheet
Dim iRow As Long

Set sh = ThisWorkbook.Sheets("Activity")

iRow = [Counta(Activity!A:A)] + 1

With sh

     .Cells(iRow, 1).Value = CDate(frmForm.Txtdate)
     .Cells(iRow, 2) = frmForm.Txtmsn.Value
     .Cells(iRow, 3) = frmForm.Cmbmode.Value
     .Cells(iRow, 4) = frmForm.Cmbdentonfms.Value
     .Cells(iRow, 5) = frmForm.Txtweight.Value
     
    
  End With


End Sub

Thank you,
 
Did the update resolve your issue?


You don't need to - but Me keyword allows you to refer to either the current worksheet, workbook, or userform where code resides without having to use their name.

Dave
Hi thought I replied, I'm afraid I still get the same sort of error code I had previously.
 
Upvote 0

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Suggests that you have other issues - Can you place a copy of your workbook with dummy data on a file sharing site like Dropbox & provide a link to it?

Dave
 
Upvote 0

Forum statistics

Threads
1,223,912
Messages
6,175,341
Members
452,638
Latest member
Oluwabukunmi

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