Run time error 424 (Object Required)
Results 1 to 4 of 4

Thread: Run time error 424 (Object Required)
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Mar 2009
    Posts
    1,622
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Default Run time error 424 (Object Required)

    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
            Cells(ActiveCell.Row, Source.Column).Select
        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 by omairhe; Feb 23rd, 2019 at 02:28 AM.
    In life never seek happiness but always be happy. Never be free but alway seek freedom.

  2. #2
    Board Regular igold's Avatar
    Join Date
    Jul 2014
    Location
    Delray Beach, FL, USA
    Posts
    2,332
    Post Thanks / Like
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)

    Default Re: Run time error 424 (Object Required)

    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.
    ​igold

    I'm a drinker with a coding problem...

    All code is written with Excel 2010 - Please test all code on a backup copy of your data.


  3. #3
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    26,976
    Post Thanks / Like
    Mentioned
    459 Post(s)
    Tagged
    45 Thread(s)

    Default Re: Run time error 424 (Object Required)

    Cross posted https://www.ozgrid.com/forum/forum/h...bject-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.
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

  4. #4
    Board Regular
    Join Date
    Mar 2009
    Posts
    1,622
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Run time error 424 (Object Required)

    Quote Originally Posted by Fluff View Post
    Cross posted https://www.ozgrid.com/forum/forum/h...bject-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/h...bject-required
    In life never seek happiness but always be happy. Never be free but alway seek freedom.

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •