1. Welcome to Chandoo.org Forums. Short message for you

    Hi Guest,

    Thanks for joining Chandoo.org forums. We are here to make you awesome in Excel. Before you post your first question, please read this short introduction guide. When posting or responding to questions please remember our values at Chandoo.org are: Humility, Passion, Fun, Awesomeness, Simplicity, Sharing Remember that we have people here for whom English is not there first language and we need to allow for this in our dealings.

    Yours,
    Chandoo
  2. Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  3. When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

RuntimeError 9, Subscript Out of range

Discussion in 'VBA Macros' started by Ashhu, Apr 16, 2018 at 1:27 PM.

  1. Ashhu

    Ashhu Active Member

    Messages:
    190
    Dear Friends

    Please help me here,
    I am trying to copy data from one workbook to another.

    the source workbook from where i copy , i have option to choose and
    the destination folder workbook name is dynamic, so i save the file name and call in code.

    but it turns out to be some issue while i call for it and show up error.

    need help to locate prob.

    Code (vb):
    Sub RetrieveFileName()

    Dim sFileName As String
    Dim Destination As String

    Destination = ActiveWorkbook.FullName

    sFileName = Application.GetOpenFilename
    Workbooks.Open sFileName
    Worksheets("Consolidated").Activate

    ActiveSheet.Range("A1").CurrentRegion.Copy Destination:=Workbooks(Destination).Worksheets("Sheet1").Range("a1")
  2. Marc L

    Marc L Excel Ninja

    Messages:
    3,673

    Hi !

    As we can't obviously guess « some issue » (we are not mind readers !)
    so first check yourself the codeline where error occurs …
  3. Ashhu

    Ashhu Active Member

    Messages:
    190
    I got this fixed, apologies for posting incomplete question.

Share This Page