#Run time error 424, object required

Vivek Roshan

New Member
Joined
Feb 15, 2018
Messages
24
Hi,

I have created a user form in sheet1(Data_Entry_Form) and my data in sheet2(ICC_Data). When I run the user form through command button in sheet1. I am getting a message "run time error #424 , object required" and when I debug, it highlighted at userform1.show. When I pressed f8, it is showing the problem in userform1 initializer. The code is given below.


Private Sub UserForm_Initialize()
Dim lrow As Long
lrow = Application.WorksheetFunction.CountA(ICC_Data.Range("A:A")) + 1
Me.ComboBox1.RowSource = "ICC_Data:A2:A" & lrow
End Sub


Any help on the above shall be highly appreciated.
Thanks,
Vivek Roshan
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
What is ICC_Data? You haven't declared, or set it.
 
Upvote 0
Try
Code:
   Dim rng As Range
   Set rng = ICC_Data.Range("A2", ICC_Data.Range("A" & Rows.Count).End(xlUp))
   Me.ComboBox1.RowSource = rng.AddressLocal
 
Upvote 0
Hi Fluff, Thanks for your reply. I have tried your suggested code. I got an error mesg as given below:

# Compile error, sub or function not defined. The underlined area is highlighted.

Can you please look into this?


Set rng = ICC_Data.Range("A2", ICC_Data.Range("A" & Rows.Count).End(xlUp))
 
Upvote 0
In your op you said
sheet2(ICC_Data)
which suggests that the sheet name is ICC_Data & the sheet codename is Sheet2.

Then in post#3 you said
ICC_Data (Incoming Correspondence)
which suggests that ICC_Data is the code name & the actual sheet name is Incoming Correspondence.

When you look at the project window in the VBE what does it say for that sheet?
 
Upvote 0
In that case try
Code:
Dim rng As Range
   Set rng = Sheet2.Range("A2", Sheet2.Range("A" & Rows.Count).End(xlUp))
   Me.ComboBox1.RowSource = rng.AddressLocal
 
Upvote 0
Thanks a lot Mr.Fluff. Now form opens without any error. May God bless you. I will seek your help once again in case of any problem.
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

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