Run time error 424 (Object Required)

omairhe

Well-known Member
Joined
Mar 26, 2009
Messages
1,837
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:

Some videos you may like

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

igold

Well-known Member
Joined
Jul 8, 2014
Messages
2,503
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
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.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
46,312
Office Version
  1. 365
Platform
  1. Windows
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.
 

omairhe

Well-known Member
Joined
Mar 26, 2009
Messages
1,837
Office Version
  1. 2019
Platform
  1. Windows
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
 

Watch MrExcel Video

Forum statistics

Threads
1,108,992
Messages
5,526,109
Members
409,685
Latest member
Bellybb

This Week's Hot Topics

Top