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
#24361
Boa tarde galera, Preciso de uma ajuda montei um procedimento que vai selecionar as células preenchidas de uma coluna, as informações selecionadas tem que ser carregadas em uma variável e depois a mesma será usada dentro do procedimento de filtro avançado?
'Estrutura de Repetição
Do While Nome <> " "
W.Select
If Nome = Aba Then
ActiveCell.Offset(0, -1).Select
Range(Selection, Selection.End(xlDown)).Row 'Selecionei as céluas
Cel = 'o que foi selecionado acima deve ser carregado nesta variável

End If

'Filtrando pelo filtro avançado
Y.Select
Sheets("Balancete").Columns("A:I").AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("C.Custo").Range(Cel) 'usar a variável , CopyToRange:=Range("A1") _
, Unique:=False
Cells.Select
Cells.EntireColumn.AutoFit
Range("A1").Select


Grato 8-)
#24390
Bom dia!!

Tente algo como:
Código: Selecionar todos
Sub Teste()
' Fonte: http://blog.contextures.com/archives/2010/12/15/excel-autofilter-with-criteria-in-a-range/
Dim Cel As Range
Set Cel = Range("A1")

' Seu código Aqui!!!
End Sub
Att
#24393
Obrigado pela resposta, mas preciso que a variável Cel carregue os endereços das Range selecionadas, exemplo: na aba Ana vai usar Range selecionada (" A1:A15"), depois o Loop vai mudar para próxima Sheets e vai para coluna "D" e carregar as Range selecionada e vai fazendo o Loop até a última Sheets, já tentei a função ActiveCell.Address mas ela só carrega o endereço da primeira Range.
Abraço.
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