Results 1 to 4 of 4

Thread: Choose from several sheets

  1. #1
    Member
    Join Date
    Aug 2012
    Posts
    72
    Rep Power
    12

    Choose from several sheets

    Hi.

    I'm with the problem in a file that I have, I'll try to explain the best way.
    When I chose the name of the worksheet as follows: "Set Original = Workbooks (Source). Worksheets (" Sheet1 ") 'my code worked, now that he tried to fetch the name to a sheet covering a column.
    It gets its name there but when does "Set Original = Workbooks (Source). Worksheets (name)" says subscript out of range error 9.
    Code:
    Dim Destino As String
    Dim Origem As String
    Dim Original As Worksheet
    Dim Copia As Worksheet
    Dim Folha As Worksheet
    Dim nome As String
    
    linha = 53
    
    For lin = 1 To linha
    
    Set Folha = Workbooks(Destino).Worksheets("Instalacoes")
    
    nome = Folha.Cells(lin, 1).Value
    
    Workbooks.Open Filename
    Origem = ActiveWorkbook.Name
    
        Set Original = Workbooks(Origem).Worksheets(nome)
    
         Set Copia = Workbooks(Destino).Worksheets(nome)
    Thanks in advance!

  2. #2
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,122
    Rep Power
    10
    Hi marreco,

    Welcome t oExcelFox !!

    It means there is no such sheet what the variable 'nome' returns. Check your sheet name.
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

  3. #3
    Member
    Join Date
    Aug 2012
    Posts
    72
    Rep Power
    12
    Hi
    Thanks, the problem was solved by your tip, thank you very much!

  4. #4
    Junior Member swinnersmusic's Avatar
    Join Date
    May 2012
    Posts
    6
    Rep Power
    0
    there is no NEXT following the FOR loop.
    What is this code trying to achieve please?

Similar Threads

  1. Reverse Vlookup Using Choose Function
    By Excel Fox in forum Excel Help
    Replies: 8
    Last Post: 07-04-2013, 01:50 AM
  2. Replies: 2
    Last Post: 04-16-2013, 01:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •