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.
#62778
Boa tarde.

Tenho uma relação de planilhas (arquivos), onde desejo salvar em PDF algumas abas(planilhas).

Criei uma relação que ao marcar “X” o loop abre e seleciona o Array das abas(planilhas) selecionadas tipo:

If Range("B" & LN).Value = "X" Then
B = "RelatRH"
End If

If Range("C" & LN).Value = "X" Then
C = "RelatMedição"
End If

If Range("D" & LN).Value = "X" Then
D = "RelatAtiv"
End If

If Range("E" & LN).Value = "X" Then
E = "Translado"
End If

If Range("F" & LN).Value = "X" Then
F = "SER025"
End If

PlanSelected = B & C & D & E & F
Workbooks.Open Filename:=PastaPontos & "\" & Site & "\" & WebPonto
Sheets(Array(PlanSelected)).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=PastaEvidencias & "2-Evidencias\" & Alocado & "\0-Enviado\" & Alocado & ".pdf"

(*) OBS. O LOOP ESTÁ FUNCIONANDO CORRETAMENTE,MEU PROBLEMA ESTÁ NA SELEÇÃO DO ARRAY PARA IMPRESSÃO / SALVAMENTO EM PDF.

Desde já agradeço o apoio de todos.
#62788
#
Experimente o código abaixo.
Substitua no código o nome "matriz" pelo nome da planilha que contém os "X" e atribua à variável Ln o número correto da linha que contém os "X".
Código: Selecionar todos
Sub SelecionaPlanilhas()
 Dim Ln As Long
 Ln = 2
 'seleciona as planilhas
  With Sheets("matriz")
   If .Range("B" & Ln).Value = "X" Then Sheets("RelatRH").Select (False)
   If .Range("C" & Ln).Value = "X" Then Sheets("RelatMedição").Select (False)
   If .Range("D" & Ln).Value = "X" Then Sheets("RelatAtiv").Select (False)
   If .Range("E" & Ln).Value = "X" Then Sheets("Translado").Select (False)
   If .Range("F" & Ln).Value = "X" Then Sheets("SER025").Select (False)
  End With
'coloque aqui as instruções que atuarão nas planilhas selecionadas
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