+ Reply to Thread
Results 1 to 7 of 7

subscript out of Range (Run time error 9), need help

  1. #1
    Forum Contributor
    Join Date
    07-17-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    713

    subscript out of Range (Run time error 9), need help

    Hi,

    AM having an error "subscript out of Range (Run time error 9)" in this macro

    Please Login or Register  to view this content.
    I highlighted a line, where i get this error.

    Please help

    Thanks
    Last edited by shiva_reshs; 07-05-2013 at 02:32 PM.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: subscript out of Range (Run time error 9), need help

    Try this
    Please Login or Register  to view this content.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: subscript out of Range (Run time error 9), need help

    Hi, shiva_reshs,

    GetOpenFilename gives you the path and the name of the file to open but it doesn´t open the file. So you would to do that prior to activating.

    Instead of
    Please Login or Register  to view this content.
    you should rather use
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Try this.
    Please Login or Register  to view this content.
    Last edited by Norie; 07-06-2013 at 10:32 PM.
    If posting code please use code tags, see here.

  5. #5
    Forum Contributor
    Join Date
    07-17-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    713

    Re: subscript out of Range (Run time error 9), need help

    Thanks.. Both method works

    One small tricks needed though..

    When I choose the file, destination file has 3 sheets and i want the data to be copied from sheet3. But the code picks up sheet1 data. Any help??

    Thanks

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: subscript out of Range (Run time error 9), need help

    Simple - change Sheet1 in this line to Sheet3 -
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    07-17-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    713

    Re: subscript out of Range (Run time error 9), need help

    sorry. it works perfectly.

    Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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