Execution error 424 object required

geoffm

New Member
Joined
Dec 11, 2017
Messages
7
I had a simple marco to hide a sheet and some rows when a listbox is clicked. it ran fine in the listbox's sheet's code but I had to move it to a global module in order to go hide rows in another sheet. Now it says the objects don't exist.
Here is my code
Code:
Public Sub ActiverLait()
    Lait.Visible = 1 'Afficher feuille Lait
    Lait.lbCulturesLait.BackColor = &HC0FFFF
    Lait.lbCulturesLait.Enabled = True
    Champs.Range("lignesLait").EntireRow.Hidden = False
    Champs.Names("lignesLait").RefersToRange.EntireRow.Hidden = False
End Sub
Where lbCulturesLait is a listbox I'm trying to change,
Lait is a worksheet
Champs is a worksheet
lignesLait is a named range

All of these lines seem to fail yet when I look at guides and references it seems to me like this is supposed to be the right syntax.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Hi Geoff,

That code works for me from a Standard Code Module (Module1) on my mockup your workbook. Which line of your code is highlighted when the error arises?
 
Upvote 0

Forum statistics

Threads
1,214,599
Messages
6,120,448
Members
448,966
Latest member
DannyC96

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