Ir ao conteúdo
  • Cadastre-se
GhostBusters

Dificuldade na programação de uma MACRO

Recommended Posts

Boa tarde, tenho a seguinte macro e gostaria da ajuda do pessoal aqui do fórum para resolver alguns problemas.

Sub Macro7()

'

' Macro7 Macro

'

'

Sheets("CEEE-D 2013").Select

Range("A3").Select

Selection.Copy

Sheets("MENSAL").Select

ActiveSheet.Paste

Sheets("CEEE-D 2013").Select

Range("L3").Select

Application.CutCopyMode = False

Selection.Copy

Sheets("MENSAL").Select

Range("D7").Select

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _

:=False, Transpose:=False

Application.CutCopyMode = False

Selection.AutoFill Destination:=Range("D7:D18"), Type:=xlFillDefault

Range("D7:D18").Select

Sheets("CEEE-D 2013").Select

Range("M3").Select

Selection.Copy

Sheets("MENSAL").Select

Range("F7").Select

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _

:=False, Transpose:=False

Application.CutCopyMode = False

Selection.AutoFill Destination:=Range("F7:F18"), Type:=xlFillDefault

Range("F7:F18").Select

Sheets("CEEE-D 2013").Select

ActiveWindow.ScrollColumn = 6

ActiveWindow.ScrollColumn = 7

ActiveWindow.ScrollColumn = 8

ActiveWindow.ScrollColumn = 9

ActiveWindow.ScrollColumn = 10

Range("O3").Select

Selection.Copy

Sheets("MENSAL").Select

Range("C7").Select

ActiveSheet.Paste

Sheets("CEEE-D 2013").Select

Range("P3").Select

Application.CutCopyMode = False

Selection.Copy

Sheets("MENSAL").Select

Range("E7").Select

ActiveSheet.Paste

Sheets("CEEE-D 2013").Select

Range("R3").Select

Application.CutCopyMode = False

Selection.Copy

Sheets("MENSAL").Select

Range("C8").Select

ActiveSheet.Paste

Sheets("CEEE-D 2013").Select

Range("S3").Select

Application.CutCopyMode = False

Selection.Copy

Sheets("MENSAL").Select

Range("E8").Select

ActiveSheet.Paste

Sheets("CEEE-D 2013").Select

ActiveWindow.ScrollColumn = 11

ActiveWindow.ScrollColumn = 12

ActiveWindow.ScrollColumn = 13

ActiveWindow.ScrollColumn = 14

ActiveWindow.ScrollColumn = 15

ActiveWindow.ScrollColumn = 16

ActiveWindow.ScrollColumn = 17

Range("U3").Select

Application.CutCopyMode = False

Selection.Copy

Sheets("MENSAL").Select

Range("C9").Select

ActiveSheet.Paste

Sheets("CEEE-D 2013").Select

Range("V3").Select

Application.CutCopyMode = False

Selection.Copy

Sheets("MENSAL").Select

Range("E9").Select

ActiveSheet.Paste

Sheets("CEEE-D 2013").Select

Range("Z3").Select

Application.CutCopyMode = False

Selection.Copy

Sheets("MENSAL").Select

Range("C10").Select

ActiveSheet.Paste

Sheets("CEEE-D 2013").Select

Range("AA3").Select

Application.CutCopyMode = False

Selection.Copy

Sheets("MENSAL").Select

Range("E10").Select

ActiveSheet.Paste

Sheets("CEEE-D 2013").Select

ActiveWindow.ScrollColumn = 18

ActiveWindow.ScrollColumn = 19

ActiveWindow.ScrollColumn = 20

ActiveWindow.ScrollColumn = 21

ActiveWindow.ScrollColumn = 22

ActiveWindow.ScrollColumn = 23

ActiveWindow.ScrollColumn = 24

ActiveWindow.ScrollColumn = 25

ActiveWindow.ScrollColumn = 26

ActiveWindow.ScrollColumn = 27

ActiveWindow.ScrollColumn = 28

Range("AC3").Select

Application.CutCopyMode = False

Selection.Copy

Sheets("MENSAL").Select

Range("C11").Select

ActiveSheet.Paste

Sheets("CEEE-D 2013").Select

Range("AD3").Select

Application.CutCopyMode = False

Selection.Copy

Sheets("MENSAL").Select

Range("E11").Select

ActiveSheet.Paste

Sheets("CEEE-D 2013").Select

Range("AF3").Select

Application.CutCopyMode = False

Selection.Copy

Sheets("MENSAL").Select

Range("C12").Select

ActiveSheet.Paste

Sheets("CEEE-D 2013").Select

Range("AG3").Select

Application.CutCopyMode = False

Selection.Copy

Sheets("MENSAL").Select

Range("E12").Select

ActiveSheet.Paste

Sheets("CEEE-D 2013").Select

ActiveWindow.ScrollColumn = 29

ActiveWindow.ScrollColumn = 30

ActiveWindow.ScrollColumn = 31

ActiveWindow.ScrollColumn = 32

Range("AK3").Select

Application.CutCopyMode = False

Selection.Copy

Sheets("MENSAL").Select

Range("C13").Select

ActiveSheet.Paste

Sheets("CEEE-D 2013").Select

Range("AL3").Select

Application.CutCopyMode = False

Selection.Copy

Sheets("MENSAL").Select

Range("E13").Select

ActiveSheet.Paste

Sheets("CEEE-D 2013").Select

ActiveWindow.ScrollColumn = 33

ActiveWindow.ScrollColumn = 34

ActiveWindow.ScrollColumn = 35

ActiveWindow.ScrollColumn = 36

ActiveWindow.ScrollColumn = 37

ActiveWindow.ScrollColumn = 38

Range("AN3").Select

Application.CutCopyMode = False

Selection.Copy

Sheets("MENSAL").Select

Range("C14").Select

ActiveSheet.Paste

Sheets("CEEE-D 2013").Select

Range("AO3").Select

Application.CutCopyMode = False

Selection.Copy

Sheets("MENSAL").Select

Range("E14").Select

ActiveSheet.Paste

Sheets("CEEE-D 2013").Select

Range("AQ3").Select

Application.CutCopyMode = False

Selection.Copy

Sheets("MENSAL").Select

Range("C15").Select

ActiveSheet.Paste

Sheets("CEEE-D 2013").Select

Range("AR3").Select

Application.CutCopyMode = False

Selection.Copy

Sheets("MENSAL").Select

Range("E15").Select

ActiveSheet.Paste

Sheets("CEEE-D 2013").Select

Range("AV3").Select

Application.CutCopyMode = False

Selection.Copy

Sheets("MENSAL").Select

Range("C16").Select

ActiveSheet.Paste

Sheets("CEEE-D 2013").Select

Range("AW3").Select

Application.CutCopyMode = False

Selection.Copy

Sheets("MENSAL").Select

Range("E16").Select

ActiveSheet.Paste

Sheets("CEEE-D 2013").Select

Range("AY3").Select

Application.CutCopyMode = False

Selection.Copy

Sheets("MENSAL").Select

Range("C17").Select

ActiveSheet.Paste

Sheets("CEEE-D 2013").Select

Range("AZ3").Select

Application.CutCopyMode = False

Selection.Copy

Sheets("MENSAL").Select

Range("E17").Select

ActiveSheet.Paste

Sheets("CEEE-D 2013").Select

Range("BB3").Select

Application.CutCopyMode = False

Selection.Copy

Sheets("MENSAL").Select

Range("C18").Select

ActiveSheet.Paste

Sheets("CEEE-D 2013").Select

Range("BC3").Select

Application.CutCopyMode = False

Selection.Copy

Sheets("MENSAL").Select

Range("E18").Select

ActiveSheet.Paste

End Sub

No entanto tenho que executa-lá apenas na linha filtrada, no meu caso tenho 65 linhas e gostaria de executar a macro na linha 1, depois na linha 4, depois na linha 26, por exemplo, como faço para a macro pegar apenas as linhas selecionadas por mim manualmente? Por Favor me ajudem estou a 3 dias tentando executar essa macro e não consigo!

Compartilhar este post


Link para o post
Compartilhar em outros sites

Boa tarde!!

Eu não entendi muito bem, mas tente..

Sub Tente()
Range("A1").AutoFilter field:=1, Criteria1:=Range("CeluasComCriterios").Value
End Sub

Leia:

http://www.ozgrid.com/VBA/autofilter-vba-criteria.htm

http://blog.contextures.com/archives/2010/12/15/excel-autofilter-with-criteria-in-a-range/

Att

Compartilhar este post


Link para o post
Compartilhar em outros sites

Crie uma conta ou entre para comentar

Você precisar ser um membro para fazer um comentário

Criar uma conta

Crie uma nova conta em nossa comunidade. É fácil!

Crie uma nova conta

Entrar

Já tem uma conta? Faça o login.

Entrar agora





Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas publicações sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×