+ Reply to Thread
Results 1 to 5 of 5

RT Error 424-Obj Required, when UNIONing 2 ranges in order to sync 2 cols of filtered data

  1. #1
    Registered User
    Join Date
    09-22-2016
    Location
    TO, ON, CA
    MS-Off Ver
    2007
    Posts
    10

    RT Error 424-Obj Required, when UNIONing 2 ranges in order to sync 2 cols of filtered data

    Hello All,


    In a nutshell, I'm trying to filter one column ("Emp Cont Type") for two values ("Regular" and "Term"), and then have those values copied over to a second column ("Employment Type Indicator"), for the exact same set of filtered data.

    Now, we all know that doing a straight "copy and paste" of filtered data does/will not work.

    So, I found out that one way to achieve the required results is as follows:•Apply the required filter
    •Select the entire source column
    •Then select the target column
    •Then perform a "Fill Right" or "Fill Left" depending on which side the target column lies

    My code below is doing exactly the above, however I find that when I run the code from a sheet "other than the one that contains the data" it bombs out with a "Runtime error 424 - Object required".

    On the other hand, if I physically activate/select the data sheet and run the code it works just fine (no error, and data gets copied across correctly)

    What I do want to achieve is to have the end-user click a button from a menu and have the code do its job (transparent to the user/in the background)...without the user having to see that a data sheet is being selected, and all kinds of things happening to the data on that sheet, and then being returned to the "menu" sheet.

    Is there any way I can either fix the error, or perhaps even achieve my desired result a different way? Perhaps I'm over-complicating things!

    Thanks.

    Please Login or Register  to view this content.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: RT Error 424-Obj Required, when UNIONing 2 ranges in order to sync 2 cols of filtered

    What line of code is highlighted in the debugger when the error occurs?

    I just skimmed your code but did see this:

    Please Login or Register  to view this content.
    You need a . before Range. The way it's written, it will refer to this range on the active sheet.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: RT Error 424-Obj Required, when UNIONing 2 ranges in order to sync 2 cols of filtered

    What line of code is highlighted in the debugger when the error occurs?

    I just skimmed your code but did see this:

    Please Login or Register  to view this content.
    You need a . before Range. The way it's written, it will refer to this range on the active sheet.

  4. #4
    Registered User
    Join Date
    09-22-2016
    Location
    TO, ON, CA
    MS-Off Ver
    2007
    Posts
    10

    Re: RT Error 424-Obj Required, when UNIONing 2 ranges in order to sync 2 cols of filtered

    @6StringJazzer,

    Thanks for the reply, however, in making the change you suggested, I now get the message "Runtime error 1004 - No cells were found", when I run the code from the "menu" sheet, and that error is displayed again the line:

    Please Login or Register  to view this content.
    Actually I did change that line slightly, by adding the .SpecialCells.... bit at the end (trying different things).

    When I run the code (with your change included) from the data sheet itself, it still runs successfully....so I don't think that that change has really made a difference

    Any other things/ways you could think of?

    Thanks again.

  5. #5
    Registered User
    Join Date
    09-22-2016
    Location
    TO, ON, CA
    MS-Off Ver
    2007
    Posts
    10

    Re: RT Error 424-Obj Required, when UNIONing 2 ranges in order to sync 2 cols of filtered

    @6StringJazzer,

    Thanks for the reply, however, in making the change you suggested, I now get the message "Runtime error 1004 - No cells were found", when I run the code from the "menu" sheet, and that error is displayed again the line:

    Please Login or Register  to view this content.
    Actually I did change that line slightly, by adding the .SpecialCells.... bit at the end (trying different things).

    When I run the code (with your change included) from the data sheet itself, it still runs successfully....so I don't think that that change has really made a difference

    To answer your question though, the line against which I received the earlier error is:

    Please Login or Register  to view this content.
    Any other things/ways you could think of?

    Thanks again.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Formulas required to lookup Multiple Cols and return Values
    By hammer2 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-20-2016, 07:48 PM
  2. Replies: 0
    Last Post: 06-19-2014, 07:11 AM
  3. [SOLVED] Required Column and Filtered data to be copied in a new sheet
    By Kamalakar M in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-20-2014, 09:48 AM
  4. [SOLVED] VBA Macro required for filtered data to a new sheet.
    By anbub1 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-03-2013, 10:48 AM
  5. Replies: 1
    Last Post: 05-12-2007, 10:06 AM
  6. Range.Select 1st pass 13 cols, 2nd paqss 25 cols twice as wide in error?
    By Craigm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-02-2006, 06:04 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1