Ir para conteúdo
Fórum Script Brasil
  • 0

ERRO VBA "Erro de tempo de execução '9': Subscrito fora do


Renato Fusco

Pergunta

Boa tarde,

Por favor, vocês poderiam me ajudar?

Sou um novo usuário de Excel e criei um macro que copia algumas colunas de uma tabela ("formatea file de nemag e mastersoft_2014_06.xlsm") e cola em uma outra ("br_kpis_jan_2015_salvo_automaticamente.xlsx").

Depois de ter gravado o macro, mandei rodar e deu certo.

Porém, quando fechei minhas planilhas e abri de novo, aparecia o seguinte erro:

"Erro de tempo de execução '9':

Subscrito fora do intervalo"

Eu já alterei os nomes das planilhas para tudo minúsculo e tirei os acentos, mas ainda não obtive êxito.

Vocês sabem o que pode ter dado errado?

O código é esse:

"

Sub SUBSTITUICAO()

'
' SUBSTITUICAO Macro
' Este macro substitui os valores de todas as colunas sem formula.
'
' Atalho do teclado: Ctrl+u
'
Windows("formatea file de nemag e mastersoft_2014_06.xlsm").Activate
ActiveWindow.ScrollColumn = 83
ActiveWindow.ScrollColumn = 77
ActiveWindow.ScrollColumn = 75
ActiveWindow.ScrollColumn = 74
ActiveWindow.ScrollColumn = 72
ActiveWindow.ScrollColumn = 68
ActiveWindow.ScrollColumn = 66
ActiveWindow.ScrollColumn = 62
ActiveWindow.ScrollColumn = 61
ActiveWindow.ScrollColumn = 58
ActiveWindow.ScrollColumn = 56
ActiveWindow.ScrollColumn = 54
ActiveWindow.ScrollColumn = 44
ActiveWindow.ScrollColumn = 39
ActiveWindow.ScrollColumn = 38
ActiveWindow.ScrollColumn = 37
ActiveWindow.ScrollColumn = 36
ActiveWindow.ScrollColumn = 35
ActiveWindow.ScrollColumn = 34
ActiveWindow.ScrollColumn = 33
ActiveWindow.ScrollColumn = 32
ActiveWindow.ScrollColumn = 31
ActiveWindow.ScrollColumn = 30
ActiveWindow.ScrollColumn = 29
ActiveWindow.ScrollColumn = 28
ActiveWindow.ScrollColumn = 27
ActiveWindow.ScrollColumn = 26
ActiveWindow.ScrollColumn = 25
ActiveWindow.ScrollColumn = 24
ActiveWindow.ScrollColumn = 23
ActiveWindow.ScrollColumn = 22
ActiveWindow.ScrollColumn = 21
ActiveWindow.ScrollColumn = 20
ActiveWindow.ScrollColumn = 19
ActiveWindow.ScrollColumn = 18
ActiveWindow.ScrollColumn = 17
ActiveWindow.ScrollColumn = 16
ActiveWindow.ScrollColumn = 15
ActiveWindow.ScrollColumn = 14
ActiveWindow.ScrollColumn = 13
ActiveWindow.ScrollColumn = 12
ActiveWindow.ScrollColumn = 11
ActiveWindow.ScrollColumn = 10
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
ActiveWindow.LargeScroll Down:=-1
ActiveWindow.ScrollRow = 300
ActiveWindow.ScrollRow = 292
ActiveWindow.ScrollRow = 245
ActiveWindow.ScrollRow = 167
ActiveWindow.ScrollRow = 128
ActiveWindow.ScrollRow = 88
ActiveWindow.ScrollRow = 73
ActiveWindow.ScrollRow = 57
ActiveWindow.ScrollRow = 49
ActiveWindow.ScrollRow = 33
ActiveWindow.ScrollRow = 18
ActiveWindow.ScrollRow = 2
Range("A1").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
ActiveWindow.ScrollColumn = 83
ActiveWindow.ScrollColumn = 82
ActiveWindow.ScrollColumn = 81
ActiveWindow.ScrollColumn = 79
ActiveWindow.ScrollColumn = 77
ActiveWindow.ScrollColumn = 75
ActiveWindow.ScrollColumn = 73
ActiveWindow.ScrollColumn = 71
ActiveWindow.ScrollColumn = 67
ActiveWindow.ScrollColumn = 64
ActiveWindow.ScrollColumn = 62
ActiveWindow.ScrollColumn = 58
ActiveWindow.ScrollColumn = 56
ActiveWindow.ScrollColumn = 53
ActiveWindow.ScrollColumn = 51
ActiveWindow.ScrollColumn = 48
ActiveWindow.ScrollColumn = 46
ActiveWindow.ScrollColumn = 45
ActiveWindow.ScrollColumn = 42
ActiveWindow.ScrollColumn = 41
ActiveWindow.ScrollColumn = 39
ActiveWindow.ScrollColumn = 38
ActiveWindow.ScrollColumn = 37
ActiveWindow.ScrollColumn = 36
ActiveWindow.ScrollColumn = 35
ActiveWindow.ScrollColumn = 34
ActiveWindow.ScrollColumn = 33
ActiveWindow.ScrollColumn = 32
ActiveWindow.ScrollColumn = 31
ActiveWindow.ScrollColumn = 30
ActiveWindow.ScrollColumn = 29
ActiveWindow.ScrollColumn = 28
ActiveWindow.ScrollColumn = 27
ActiveWindow.ScrollColumn = 26
ActiveWindow.ScrollColumn = 25
ActiveWindow.ScrollColumn = 24
ActiveWindow.ScrollColumn = 23
ActiveWindow.ScrollColumn = 22
ActiveWindow.ScrollColumn = 21
ActiveWindow.ScrollColumn = 19
ActiveWindow.ScrollColumn = 18
ActiveWindow.ScrollColumn = 17
ActiveWindow.ScrollColumn = 16
ActiveWindow.ScrollColumn = 15
ActiveWindow.ScrollColumn = 14
ActiveWindow.ScrollColumn = 12
ActiveWindow.ScrollColumn = 11
ActiveWindow.ScrollColumn = 10
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
ActiveWindow.ScrollRow = 3730
ActiveWindow.ScrollRow = 3722
ActiveWindow.ScrollRow = 3667
ActiveWindow.ScrollRow = 3620
ActiveWindow.ScrollRow = 3534
ActiveWindow.ScrollRow = 3471
ActiveWindow.ScrollRow = 3369
ActiveWindow.ScrollRow = 3298
ActiveWindow.ScrollRow = 3196
ActiveWindow.ScrollRow = 3094
ActiveWindow.ScrollRow = 2992
ActiveWindow.ScrollRow = 2906
ActiveWindow.ScrollRow = 2812
ActiveWindow.ScrollRow = 2718
ActiveWindow.ScrollRow = 2600
ActiveWindow.ScrollRow = 2514
ActiveWindow.ScrollRow = 2396
ActiveWindow.ScrollRow = 2262
ActiveWindow.ScrollRow = 2137
ActiveWindow.ScrollRow = 2058
ActiveWindow.ScrollRow = 1948
ActiveWindow.ScrollRow = 1815
ActiveWindow.ScrollRow = 1713
ActiveWindow.ScrollRow = 1635
ActiveWindow.ScrollRow = 1580
ActiveWindow.ScrollRow = 1517
ActiveWindow.ScrollRow = 1454
ActiveWindow.ScrollRow = 1399
ActiveWindow.ScrollRow = 1360
ActiveWindow.ScrollRow = 1313
ActiveWindow.ScrollRow = 1273
ActiveWindow.ScrollRow = 1242
ActiveWindow.ScrollRow = 1219
ActiveWindow.ScrollRow = 1179
ActiveWindow.ScrollRow = 1140
ActiveWindow.ScrollRow = 1109
ActiveWindow.ScrollRow = 1077
ActiveWindow.ScrollRow = 1038
ActiveWindow.ScrollRow = 999
ActiveWindow.ScrollRow = 960
ActiveWindow.ScrollRow = 873
ActiveWindow.ScrollRow = 826
ActiveWindow.ScrollRow = 787
ActiveWindow.ScrollRow = 748
ActiveWindow.ScrollRow = 701
ActiveWindow.ScrollRow = 653
ActiveWindow.ScrollRow = 606
ActiveWindow.ScrollRow = 575
ActiveWindow.ScrollRow = 544
ActiveWindow.ScrollRow = 512
ActiveWindow.ScrollRow = 489
ActiveWindow.ScrollRow = 465
ActiveWindow.ScrollRow = 449
ActiveWindow.ScrollRow = 426
ActiveWindow.ScrollRow = 418
ActiveWindow.ScrollRow = 402
ActiveWindow.ScrollRow = 387
ActiveWindow.ScrollRow = 379
ActiveWindow.ScrollRow = 371
ActiveWindow.ScrollRow = 363
ActiveWindow.ScrollRow = 355
ActiveWindow.ScrollRow = 332
ActiveWindow.ScrollRow = 261
ActiveWindow.ScrollRow = 167
ActiveWindow.ScrollRow = 104
ActiveWindow.ScrollRow = 26
ActiveWindow.ScrollRow = 2
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Windows("br_kpis_jan_2015_salvo_automaticamente.xlsx").Activate
ActiveWindow.SmallScroll Down:=-9
Windows("formatea file de nemag e mastersoft_2014_06.xlsm").Activate
ActiveWindow.ScrollColumn = 83
ActiveWindow.ScrollColumn = 82
ActiveWindow.ScrollColumn = 80
ActiveWindow.ScrollColumn = 79
ActiveWindow.ScrollColumn = 76
ActiveWindow.ScrollColumn = 72
ActiveWindow.ScrollColumn = 69
ActiveWindow.ScrollColumn = 64
ActiveWindow.ScrollColumn = 59
ActiveWindow.ScrollColumn = 54
ActiveWindow.ScrollColumn = 42
ActiveWindow.ScrollColumn = 25
ActiveWindow.ScrollColumn = 17
ActiveWindow.ScrollColumn = 14
ActiveWindow.ScrollColumn = 12
ActiveWindow.ScrollColumn = 11
ActiveWindow.ScrollColumn = 10
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 1
ActiveWindow.ScrollRow = 324
ActiveWindow.ScrollRow = 316
ActiveWindow.ScrollRow = 269
ActiveWindow.ScrollRow = 135
ActiveWindow.ScrollRow = 26
ActiveWindow.ScrollRow = 2
Columns("A:Y").Select
Application.CutCopyMode = False
Selection.Copy
Windows("br_kpis_jan_2015_salvo_automaticamente.xlsx").Activate
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AI1").Select
Windows("formatea file de nemag e mastersoft_2014_06.xlsm").Activate
Columns("AA:AO").Select
Application.CutCopyMode = False
Selection.Copy
Windows("br_kpis_jan_2015_salvo_automaticamente.xlsx").Activate
Range("AA1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AQ1").Select
Windows("formatea file de nemag e mastersoft_2014_06.xlsm").Activate
Columns("AQ:BC").Select
Application.CutCopyMode = False
Selection.Copy
Windows("br_kpis_jan_2015_salvo_automaticamente.xlsx").Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ScrollColumn = 38
ActiveWindow.ScrollColumn = 39
ActiveWindow.ScrollColumn = 40
ActiveWindow.ScrollColumn = 41
ActiveWindow.ScrollColumn = 42
ActiveWindow.ScrollColumn = 43
ActiveWindow.ScrollColumn = 44
ActiveWindow.ScrollColumn = 45
ActiveWindow.ScrollColumn = 46
ActiveWindow.ScrollColumn = 47
ActiveWindow.ScrollColumn = 48
ActiveWindow.ScrollColumn = 49
ActiveWindow.ScrollColumn = 50
ActiveWindow.ScrollColumn = 51
ActiveWindow.ScrollColumn = 52
Windows("formatea file de nemag e mastersoft_2014_06.xlsm").Activate
Columns("BE:CY").Select
Application.CutCopyMode = False
Selection.Copy
Windows("br_kpis_jan_2015_salvo_automaticamente.xlsx").Activate
Range("BE1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
"
Agradeço desde já.
Editado por Renato Fusco
Link para o comentário
Compartilhar em outros sites

2 respostass a esta questão

Posts Recomendados

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,3k
    • Posts
      652,3k
×
×
  • Criar Novo...