none
error code 9 RRS feed

  • Question

  • Hi everyone! Hope you can help me. I've been trying to create a macro which will select several worksheets and move them into a new workbook (created at the moment with retreived name). I'm getting an error code '9 (don't know the exact translation as my xls was installed in spanish)... I guess it is like "subindex out of range"... or so

    Anyway, here's part of the code:


    Sub Export()

        Dim Response As String
        Dim Archivo As String
        Dim NomArch As Workbook
        Dim Base As Workbook
        
       
        Sheets(Array("subs", "subs x promo", "Hoja3", "Hoja7", "mix", "mix dia", "ARP eq", _
         "ARP mkt", "NE", "NE eq", "Col eq", "Col mkt", "Regiones", "DF Nac")).Select
        Sheets("subs").Activate

        Response = Application.InputBox("¿date?", _
             "date", , 250, 75, "", , 1)
            
        If Response <> False Then
       
        Archivo = "MKT_Producto " & Response & ".xlsx"
       
        Set NomArch = Workbooks.Add
        NomArch.SaveAs ("C:\Documents and Settings\cecy\Mis documentos\" & Archivo)
              
       With Windows("Base Macros.xlsx")
      
       Sheets(Array("subs", "subs x promo", "Hoja3", "Hoja7", "mix", "mix dia", "ARP eq", _ '>> right here I'm getting the error code
         "ARP mkt", "NE", "NE eq", "Col eq", "Col mkt", "Regiones", "DF Nac")).Move before:= _  
         NomArch.Sheets(1)

        End With
     
        End If
      End Sub

     

    Friday, November 5, 2010 12:40 AM

All replies

  • I forgot to tell you... Base Macros.xlsx is the source workbook and NomArch is the destination workbook
    Friday, November 5, 2010 12:50 AM