marreco
08-27-2012, 12:46 AM
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.
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!
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.
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!