What causes this runtime 424 "Object Required" error?

gers1978

Board Regular
Joined
Sep 9, 2014
Messages
74
I have some code and one of the subs contains this line:

Code:
Do Until Sheet1.Range("A" & Row).Value = vbNullString

It works flawlessly.

However I now want to run this code on a different sheet, namely one called "Invoice". So I changed the code too:

Code:
Do Until Invoice.Range("A" & Row).Value = vbNullString

However now when I run it, I get a runtime 424 error, "Object Required".

If I change it to:

Code:
Do Until Worksheets("Invoice").Range("A" & Row).Value = vbNullString

again, it works fine.

Can anyone tell me what's going on, and why sometimes you need to use "Worksheets("<name>")" format and sometimes not?

Thanks!

Also posted here: http://www.ozgrid.com/forum/showthread.php?t=197330&p=759134#post759134
 
Last edited:
Are you making this up? :eek:

There's no "Modules" in the object browser.

EDIT: Modules.Add appears to just add a code module.
 
Upvote 0

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Curious.

Does it have any surviving utility?
 
Upvote 0
It gives you some ability to add code without going via VBProject so you aren't subject to the Trust Center security setting, I suppose.
 
Upvote 0

Forum statistics

Threads
1,215,566
Messages
6,125,597
Members
449,238
Latest member
wcbyers

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