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.
#38495
Boa tarde, colegas do fórum.

Tenho essa parte de um código de uma planilha que copia as fórmulas e formatação condicional da linha 2 da tabela e cola na linha 1.
Precisava alterar para copiar somente as fórmulas e a formatação condicional , mas agora da última linha dessa tabela. Como ficaria a alteração?
Código: Selecionar todos
Sub InserirLinha()

    Application.ScreenUpdating = False
        
    Dim TabelaAtividades As ListObject
    
    Set TabelaAtividades = wshAtividadesDiarias.ListObjects("TB_AtividadesDiarias")
    
    On Error Resume Next
    TabelaAtividades.ListRows.Add (1), alwaysinsert:=True
    TabelaAtividades.ListRows(2).Range.Copy
    TabelaAtividades.ListRows(1).Range.PasteSpecial xlPasteFormats
    Application.CutCopyMode = False
    
'
'
'
'
     Application.ScreenUpdating = True   
End Sub

#38496
Consegui resolver aqui dessa maneira:
Código: Selecionar todos
Sub InserirLinha()

    Application.ScreenUpdating = False
        
    Dim TabelaAtividades As ListObject
    Dim ULinha As Long
        
    Set TabelaAtividades = wshAtividadesDiarias.ListObjects("TB_AtividadesDiarias")
    ULinha = TabelaAtividades.Range.Rows.Count
    
    On Error Resume Next
    TabelaAtividades.ListRows.Add (1), alwaysinsert:=True
    'TabelaAtividades.ListRows(2).Range.Copy
    TabelaAtividades.ListRows(ULinha).Range.Copy
    TabelaAtividades.ListRows(1).Range.PasteSpecial xlPasteFormats
    Application.CutCopyMode = False
    
'
'
'
'
     Application.ScreenUpdating = True   
End Sub

Obrigado.
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