+ Reply to Thread
Results 1 to 7 of 7

Selecting a cell in another workbook - 1004: Active method of range class failed

  1. #1
    Forum Contributor
    Join Date
    09-22-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 2019
    Posts
    309

    Selecting a cell in another workbook - 1004: Active method of range class failed

    Having got to open a workbook from another and scroll to a specific line in the second workbook, I now want to position to a specific cell in the second workbook using a row number found from a formula in a cell in the second workbook.

    (The second workbook is from OneDrive so it can't contain VBA stuff and has to rely on being driven from VBA in the workbook on my computer)

    The Code I have is as follows and does just about everything but doesn't position to the specific cell number (from a long "IF" formula in BB1) in column A, coming up with "1004: Active method of range class failed"

    Please Login or Register  to view this content.
    I've searched the Internet but can't find anything that points me in a direction to fix this.

    Any ideas please??

    Much appreciated

    Frankie
    Last edited by Frankie_The_Flyer; 07-18-2019 at 10:51 PM.

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,916

    Re: Selecting a cell in another workbook - 1004: Active method of range class failed

    This
    Please Login or Register  to view this content.
    is not a row number!!!
    Unless of course if the cell BB1 (Column BB row 1 ) actually contains the row number you're looking for.
    So it's back to the drawing board
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Forum Contributor
    Join Date
    09-22-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 2019
    Posts
    309

    Re: Selecting a cell in another workbook - 1004: Active method of range class failed

    Hi Keebellah

    The Cell BB1 has an "IF" formula that looks at another cell then searches a list of cells to find the match (i.e. =IF(AX1=E12, Row(E12),IF(AX1=E22,ROW(22),IF(AX1=E31,ROW(E31)))) etc). So while BB1 holds a formula, the result (Value??) is the row number if the number in the E cell matched the number in AX1.

    Having found the right row, a Conditional Format (in the second worksheet) then colours in the cell (E12 or what ever), but the focus remains on BB1. I need the focus to go to column A and the Row Number at BB1. i.e. A12 or A22 or A31 etc.
    Does that make sense??

  4. #4
    Forum Contributor
    Join Date
    09-22-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 2019
    Posts
    309

    Re: Selecting a cell in another workbook - 1004: Active method of range class failed

    Whooo Hoooo! Cracked this too!

    Had to direct the Activation command directly to the worksheet.

    Wb1.Sheets(CorrectSheet).Cells(myRow, "A").Activate
    in place of
    Cells(myRow, "A").Activate


    So pleased!!

  5. #5
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,916

    Re: Selecting a cell in another workbook - 1004: Active method of range class failed

    In that case you have to check first if BB! actually contains a number.
    If that's true then, since myRow is a long value which is correct you make the result long too
    Please Login or Register  to view this content.
    Short quick and dirty explanation. Going off-line now for a long weekend.
    Will read what you got after sunday

  6. #6
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,916

    Re: Selecting a cell in another workbook - 1004: Active method of range class failed

    Tops, great,

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    82,813

    Re: Selecting a cell in another workbook - 1004: Active method of range class failed

    Administrative Note:

    @Frankie

    You have forgotten your code tags again - please go back and add them.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

+ 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. ERROR 1004: Method Of Range Class Failed.
    By Mathijs.Marketing in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-08-2018, 04:16 AM
  2. pastespecial method of range class failed 1004
    By Abbadon486 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-25-2014, 12:08 PM
  3. Replies: 1
    Last Post: 01-07-2014, 01:08 AM
  4. [SOLVED] VB error:"1004" Calculate method of range class failed when selecting a cell with Array
    By vayana in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-25-2013, 06:48 PM
  5. Runtime Error 1004 "Active method of range class failed".
    By new2excel2012 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-14-2012, 07:55 AM
  6. sort method of range class failed error 1004
    By droberts77uk in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-23-2009, 11:09 PM
  7. 1004 Select Method Of Range Class Failed
    By Blewyn in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 04-02-2007, 08:13 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