Results 1 to 5 of 5

workbooks.open: select method of range class failed

This is a discussion on workbooks.open: select method of range class failed within the Excel Questions forums, part of the Question Forums category; Hi All, Have been searching the web for a solution to this problem but nothing working for me. Basically I ...

  1. #1
    Board Regular
    Join Date
    Nov 2011
    Posts
    62

    Default workbooks.open: select method of range class failed

    Hi All,

    Have been searching the web for a solution to this problem but nothing working for me.

    Basically I recorded a macro which copies cell values into another workbook. This runs fine as a stand alone marco but I have tried to add it to a larger piece of code which returns the error: 'select method of range class failed'

    Debug highlights: Range("A2").Select

    Any help appreciated.

    Code:
    Sub Invoice_List()
    '
    ' Invoice_List Macro
    
        Range("A26:G26").Select
        Selection.Copy
        
        Workbooks.Open Filename:="C:\Users\Dell\Desktop\Acoustic Files\Web Booking Macro\Testing Invoice List.xlsx"
       
        Worksheets("Invoices").Activate
     
        Range("A2").Select
        
        Rows("2:2").Select
        Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
        
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        
       ActiveWorkbook.Save
        ActiveWindow.Close
        
    End Sub

  2. #2
    Board Regular Warship's Avatar
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    889

    Default Re: workbooks.open: select method of range class failed

    try deleting it. your next line is another "select" so it does nothing anyway
    Regards, Warship
    Excel 2007 | 2010 on XP | Vista | 7 | 8.1

    We learn by teaching... Please complete the learning curve with feedback.

    GET LOST! Support Search & Rescue.

    Frustration is due to lack of knowledge. Lack of knowledge is due to frustration. Relax.
    Quandary: How is it that the Calendar is moving so fast when the Clock is moving so slow?


    ALWAYS USE A COPY OF YOUR FILE WHEN TESTING CODE !

  3. #3
    MrExcel MVP
    Moderator
    Smitty's Avatar
    Join Date
    May 2003
    Location
    Crested Butte, CO
    Posts
    27,122

    Default Re: workbooks.open: select method of range class failed

    Try without selecting:

    Sub Invoice_List()
    '
    ' Invoice_List Macro

        Range("A26:G26").Copy
        
        Workbooks.Open Filename:="C:\Users\Dell\Desktop\Acoustic Files\Web Booking Macro\Testing Invoice List.xlsx"
      
            With Worksheets("Invoices").Rows("2:2")
                .Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
                .PasteSpecial Paste:=xlPasteValues
            End With
        
        ActiveWorkbook.Close True
        
    End Sub


    HTH,
    Smitty

    Every once in a while, there's a sudden gust of gravity...

    Check out my new book at the Mr. Excel Bookstore!

    Mr. Excel HTML Maker - Post a shot of your sheet

  4. #4
    Board Regular
    Join Date
    Nov 2011
    Posts
    62

    Default Re: workbooks.open: select method of range class failed

    In response to Warship: Ive tried that but then it highlights Rows(2:2).Select with an same error.
    Last edited by lomax; Nov 11th, 2012 at 11:49 AM.

  5. #5
    Board Regular
    Join Date
    Nov 2011
    Posts
    62

    Default Re: workbooks.open: select method of range class failed

    Wow Smitty, nice one, thanks!

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
  •  


DMCA.com