Este fórum está sendo desativado

Depois de 9 anos, este fórum será desativado. Mas calma.... estamos migrando para uma comunidade no DISCORD. Junte-se a nós.

ENTRAR PARA DISCORD

Tópicos relacionados a códigos VBA, gravação de macros, etc.
  • Avatar do usuário
  • Avatar do usuário
Avatar do usuário
Por Dione
Posts Avatar
#66479
Tenho o código abaixo que imprime as abas determinas. Mas gostaria de adicionar condição em cada aba,  e se tal condição seja  atendida a aba seja impressa. Pois nem sempre preciso que seja impressa todas as abas.

Condição: Se a célula AA1 de cada aba seja =1 imprimir, diferente disso não imprimir.



Sub SALVAR_PDF()
'
' SALVAR_PDF Macro
'

'
    ActiveWorkbook.Save
    Sheets(Array("Aut", "+A", "2", "3", "4", "S", "A")).Select
    Sheets("+A").Activate
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
        "C:\Users\P\Downloads\Projeto " & Cells(7, 2).Value & ".pdf", Quality:=xlQualityStandard, _
        IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
        True
    Sheets("+A").Select
   
End Sub
#66767
Segue:

Sub SALVAR_PDF()
'
' SALVAR_PDF Macro
'

'
ActiveWorkbook.Save
Dim List()
Dim NList()
Dim tamanho As Integer
List = Array("Aut", "+A", "2", "3", "4", "S", "A")
tamanho = 0
For Each aba In List
If (Sheets(aba).Range("AA1").Value = 1) Then
ReDim Preserve NList(tamanho)
NList(tamanho) = aba
tamanho = tamanho + 1
End If
Next


Sheets(NList).Select
Sheets("+A").Activate
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Users\P\Downloads\Projeto " & Cells(7, 2).Value & ".pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
True
Sheets("+A").Select

End Sub
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Estamos migrando para uma comunidade no Discord