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.
#35480
Pessoal,

Tenho uma macro rodando que lista todas as abas da minha planilha (são muitas), porém, algumas dessas abas nao precisariam entrar na lista, pois sao abas de controle apenas, e nao abas de clientes (foco da planilha). Tem alguma forma desta macro listar somente as abas nao ocultas?
Código: Selecionar todos
Sub ListaPlans()
'
' ListaPlans Macro
'

' Atalho do teclado: Ctrl+Shift+I
'

Dim ws As Worksheet, linha As Integer
Application.ScreenUpdating = False

'Recupera a ultima linha
linha = Sheets("Relatorio").Range("P1").Value

For Each ws In ThisWorkbook.Worksheets
    If ws.Name <> "Relatorio" Then
        If ws.Name <> "Template" Then
        
        Sheets("Relatorio").Range("A" & linha).Value = ws.Name
        Sheets("Relatorio").Hyperlinks.Add Anchor:=Range("A" & linha), _
        Address:="", SubAddress:="'" & ws.Name & "'!A1", TextToDisplay:=ws.Name
        
        linha = linha + 1
                
    End If
        End If
    
Next ws

'Salva a ultima linha
Sheets("Relatorio").Range("P1").Value = linha


Application.ScreenUpdating = True
End Sub
#35484
Experimente:
Código: Selecionar todos
Sub ListaPlansVisíveis()
 Dim ws As Worksheet
 For Each ws In ThisWorkbook.Worksheets
  If ws.Name <> "Relatorio" And ws.Name <> "Template" And ws.Visible Then
    Sheets("Relatorio").Cells(Rows.Count, 1).End(3)(2) = ws.Name
    Sheets("Relatorio").Hyperlinks.Add Anchor:=Cells(Rows.Count, 1).End(3), _
        Address:="", SubAddress:="'" & ws.Name & "'!A1", TextToDisplay:=ws.Name
  End If
 Next
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