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.
Por AlanBC
Posts
#38103
ola pessoal... boa tarde!
anexei um exemplo pra melhor entendimento do que preciso. nao consigo fazer as macros funcionarem de forma independente pra cada tabela.
quero excluir a ultima linha de cada tabela se estiver vazia (com alerta), de forma independente, porem as tabelas são em sequencia, sem intervalo de linha entre uma e outra. ajuda a adaptar a macro.
podem me ajudar por gentileza... obrigado.
Você não está autorizado a ver ou baixar esse anexo.
#38206
Experimente:
Código: Selecionar todos
Sub ExcluiÚlimaVaziaTab1()
 Dim LR As Long
  With ActiveSheet.ListObjects("tabTeste01")
   LR = .ListRows.Count
    If LR > 0 Then
      If Application.Application.CountA(.ListRows(LR).Range) = 0 Then
       .ListRows(LR).Delete
      End If
    End If
  End With
End Sub
Código: Selecionar todos
Sub ExcluiÚlimaVaziaTab2()
 Dim LR As Long
  With ActiveSheet.ListObjects("tabTeste02")
   LR = .ListRows.Count
    If LR > 0 Then
      If Application.Application.CountA(.ListRows(LR).Range) = 0 Then
       .ListRows(LR).Delete
      End If
    End If
  End With
End Sub
dica - instale os códigos acima em um módulo comum (menu Inserir / Módulo) e não no módulo da planilha como você colocou os atuais códigos.
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