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
#69968
Boa tarde!

É possível criar no VBA, um método para colocar os nomes da coluna A em ordem, da seguinte maneira alternando
a primeira letra do alfabeto com a última, a segunda letra com a penúltima e assim segue.
Exemplo: AZ BY CX DW EV ...

Outros nomes serão adicionado a lista, automaticamente entram na ordem estabelecida acima.

Grato - Geneci.
Você não está autorizado a ver ou baixar esse anexo.
#69971
Experimente uma cópia do código abaixo no módulo da planilha.
Código: Selecionar todos
Private Sub Worksheet_Change(ByVal Target As Range)
 Dim LR As Long
  If Target.Count > 1 Then Exit Sub
  If Target.Column <> 1 Then Exit Sub
  LR = Cells(Rows.Count, 1).End(3).Row
  Application.ScreenUpdating = False
  Range("A1:A" & LR).Sort Key1:=[A1], Order1:=xlAscending
  Range("A1:A" & LR).Copy [B1:C1]: Columns(3).Insert: [C1] = 1
  Range("C1").AutoFill Destination:=Range("C1:C" & LR), Type:=xlFillSeries
  Range("C1:C" & LR).Copy Cells(LR + 1, 3): Range("C1:C" & 2 * LR).Copy [E1]
  Range("B1:C" & 2 * LR).Sort Key1:=[C1], Order1:=xlAscending
  Range("D1:E" & 2 * LR).Sort Key1:=[E1], Order1:=xlDescending
  Range("C:C,E:E").Delete: [C1].Insert shift:=xlDown
  Range("B1:B" & 2 * LR).SpecialCells(4).Delete shift:=xlToLeft
  Columns(2).RemoveDuplicates Columns:=1
  Range("B1:B" & LR).Cut [A1]
End Sub
#
funcionamento - o código será executado ao incluir ou ao excluir manualmente um nome na coluna A.
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