Run time error 424 (Object Required)

omairhe

Well-known Member
Joined
Mar 26, 2009
Messages
2,040
Office Version
  1. 2019
Platform
  1. Windows
Hey all,

I am having trouble with this code.The red highlighted line is giving me a Run Time Error 424 (Object Required)

Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Application.EnableEvents = False
Worksheets("HSheet").[B3] = Worksheets("HSheet").[B2]
Worksheets("HSheet").[B2] = Target.Column
Application.EnableEvents = True
Set Target = Worksheets("HSheet").[B4]
If Target.Value <> 0 Then
    Dim ws As Worksheet
    For Each ws In Sheets
        ws.Select
[COLOR=#ff0000][B]        [U]Cells(ActiveCell.Row, Source.Column).Select[/U][/B][/COLOR]
    Next
    Sh.Select
End If
End Sub

What the code should do is select the same column across multiple sheets. However if the SheetChange value was on the same column as the previous SheetChange value, then the code should not run again until a new column's value been entered.

B2 = new value , B3 = old value
Formula in B4 => B2-B3 = 0

will appreciate any help.
Thanks
 
Last edited:

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Hi,

Although you provided an explanation I am not 100% sure what you are trying to do. That said, one problem is the word "Source" in the line you are having issues with.

Excel is seeing that as an Undefined Variable. If you were using "Option Explicit", it would have shown up immediately before any of the code was executed.

I hope this helps.
 
Upvote 0
Cross posted https://www.ozgrid.com/forum/forum/...-macros/1215246-runtime-error-object-required

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0
Cross posted https://www.ozgrid.com/forum/forum/...-macros/1215246-runtime-error-object-required

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.

Yes,. Thanks for pointing that out.

https://www.ozgrid.com/forum/forum/...-macros/1215246-runtime-error-object-required
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,160
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