Object Required Error With A Userform

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,616
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I seem to be stuck with a problem that likely has a very simple solution ...

My Code ...

Rich (BB code):
        'update userform
        With uf1_main
        'active
            With .lb_cntaba_dt
                .Caption = cnt_dt
                If cnt_dt = 0 Then
                    .Enabled = False
                    .lb_aba_dt.Enabled = False
                End If
            End With
            ...

uf1_main is a userform and and I'm trying to update it's objects. I am getting an "object required" error with the line in red which I assume means the actual userform isn't being recognized.
 
The reason I asked to see all the code was to ensure you haven't started an If or With statement without an equivalent End If or End With.

There's nothing else I can suggest I'm afraid :(

Someone else on the forum may have an idea as to how to solve the issue.

Robert
 
Upvote 0

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
You're welcome :)

Just looking at your original post - it is missing an End With i.e. it should look like this:

Rich (BB code):
update userform
With uf1_main
    'active
    With .lb_cntaba_dt
        .Caption = cnt_dt
        If cnt_dt = 0 Then
            .Enabled = False
            .lb_aba_dt.Enabled = False
        End If
   End With
End With
 
Last edited:
Upvote 0
Hi Robert, that would be awesome if that was the problem!! My OP didn't go into the full code, but in addition to the label presented, I had about a dozen more also being updated "With uf1_main". (See the purple bits in my full code, they were all within the With - End With". I'm confident I hadn't excluded that, but I'm not certain. It might be worth revisiting.
 
Upvote 0
You can't use the Designer on an open form. You also can't use the default instance of a form that is in another workbook. You'd need a function in the other workbook that returns the form before you can manipulate it from a different workbook. The whole thing sounds like bad design to me though.
 
Upvote 0
Thanks Rory. I am going back to the design board.
 
Upvote 0
Not sure if I should start another thread or not, but I'm considering closing the form 'group_1' once the information has been submitted. Doing this exposes the open userform 'uf1_main', but it's in a static condition.
After I close group 1, how can I force 'uf1_main' to update it's statistical information based on the changes made by the user input from 'group_1'? I could put an "update button" on the form, but I'd prefer it be a bit more automated? Could a run a macro (in wb1) from wb2, (the one that closed 'group_1"), that would provide the updates?
 
Last edited:
Upvote 0
You can use Run to run code in a different workbook, but it still sounds to me like you need to redesign the whole thing, as it's all too interdependent as it stands.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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