+ Reply to Thread
Results 1 to 8 of 8

Runtime Error 424 generated when activating file identified in cell

  1. #1
    Valued Forum Contributor
    Join Date
    01-16-2012
    Location
    England
    MS-Off Ver
    MS 365 Version 2501 64-bit
    Posts
    1,491

    Runtime Error 424 generated when activating file identified in cell

    Attached ORDER file has DropLists of Products and Suppliers in Cols B - C

    Attached Supplier file contain PRODUCT and COST columns.(Real folder has several different supplier files).

    User selects a Product and then a Supplier.

    Worksheet change finds the relevant Supplier file, the Product selected in the ORDER file, and copies the Cost from Col B of the SUPPLIER into Col D of the ORDER file.

    Please Login or Register  to view this content.
    All solutions, suggestions and alternatives welcome as ever.

    Ochimus
    Attached Files Attached Files

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Runtime Error 424 generated when activating file identified in cell

    I have edited the code but it might not help very much. The line in red font is effective only if the workbook is already open. If it is not already open then it would need to be like this:
    Please Login or Register  to view this content.
    to open the workbook and set the object variable. Also, I note the file extension is .xls but your sample files are posted as .xlsx and .xlsm, so that might also need editing.



    Please Login or Register  to view this content.
    P.S. Using Range(Target.Address) is a redundant expression. Target is a range, so that is all you need when referring to that range.
    Last edited by JLGWhiz; 06-06-2019 at 03:20 PM.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Valued Forum Contributor
    Join Date
    01-16-2012
    Location
    England
    MS-Off Ver
    MS 365 Version 2501 64-bit
    Posts
    1,491

    Re: Runtime Error 424 generated when activating file identified in cell

    JLGWhiz,

    Many thanks for response and suggestions.

    The original ORDER file had a macro that opened the various supplier files when it launched, so the Supplier file would have been open before the Change macro fired, but I removed that and used your amended line to open whichever Supplier file was in the Target cell.

    It didn't work whilst the folder holding the files was in the Cloud.

    So I copied them to the "C" drive, opened ORDERS and changed the Target.
    Supplier file now opens, but setting the Worksheet as "Sheet 1 in the Supplier file" throws a 'Runtime Error 438 - Object doesn't support this property or method'.

    Simply can't see where the Syntax is wrong?

    Ochimus
    Last edited by Ochimus; 06-08-2019 at 08:25 AM.

  4. #4
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Runtime Error 424 generated when activating file identified in cell

    I flunked mental telepathy, so you will need to post the code as you currently have it so I can take a look at it.

  5. #5
    Valued Forum Contributor
    Join Date
    01-16-2012
    Location
    England
    MS-Off Ver
    MS 365 Version 2501 64-bit
    Posts
    1,491

    Re: Runtime Error 424 generated when activating file identified in cell

    JLGWhiz,

    With both files on the machine, not in the Cloud, it opens the Supplier file, but then fails to "set" Sheet1, so the Index/Match doesn't link to anything.


    Please Login or Register  to view this content.
    Ochimus

  6. #6
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Runtime Error 424 generated when activating file identified in cell

    There was a typo in your worksheet function statement. I changed that statement to VBA equivalent and also changed Sheet1 code name to Sheets("Sheet1") sheet name. Sheet 1, Sheets(1) and Sheets("Sheet1") can be three different sheets in the same workbook because of the way Excel is designed. See if the code below will work for you.

    Please Login or Register  to view this content.
    Last edited by JLGWhiz; 06-09-2019 at 01:19 PM.

  7. #7
    Valued Forum Contributor
    Join Date
    01-16-2012
    Location
    England
    MS-Off Ver
    MS 365 Version 2501 64-bit
    Posts
    1,491

    Re: Runtime Error 424 generated when activating file identified in cell

    JLGWhiz

    Many thanks for the suggested changes, which almost "did the trick".

    Thanks to your advice, the attached amended Code works perfectly, opening the correct Supplier file. posting the correct value, and closing the Supplier file at the end.

    Please Login or Register  to view this content.
    Can now mark this as Solved.

    Ochimus

  8. #8
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Runtime Error 424 generated when activating file identified in cell

    Glad you got it worked out,
    Regards, JLG

+ 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] Need Help with Runtime Error if same file exists
    By whrsma in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-07-2017, 12:48 PM
  2. Runtime error '53': File not found
    By blindbeggar in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-12-2016, 04:09 AM
  3. Error 1004 when trying to save file with name generated from cell value
    By Terios1951 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-15-2015, 04:49 PM
  4. [SOLVED] Runtime error '53': File not found
    By abousetta in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-03-2015, 02:36 PM
  5. runtime error 52 bad file name or number
    By fabdullaster in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-17-2013, 06:55 AM
  6. File Name Causes Runtime Error 1004
    By Robert in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-10-2005, 10:55 AM
  7. Activating cell in a file
    By Roger in forum Excel General
    Replies: 2
    Last Post: 07-07-2005, 07:05 PM

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