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
Por UngerSantos
Posts
#20891
Olá a todos,

o meu problema é que tenho 3 combobox que precisam de informaçao de um e de outro, pretendo que quando selecciono o combobox 1 me filtra os valores de uma tabela com o valor igual à combobox1,
tehnho o seguinte código que só me dá valores únicos de uma coluna, mas pretendo que os valores dessa coluna com o valor da comobobox1 passa para os valores da coluna nao repetidos de AL.

Private Sub Comb_Datum_Change()
Dim sn, sn1 As Variant
Dim Rw As Variant
Dim DatumValue As Date

DatumValue = Me.Comb_Datum.Value
sn = Sheets(2).Range("B2:B65536") 'Combibox Projekt Filter
sn1 = Sheets(2).Range("AL2:AL65536") 'Combibox Projekt Filter

With CreateObject("System.Collections.ArrayList") 'Combibox Datum Filter
For Each Rw In sn1
If Rw = "" Then GoTo a:
'Ou aqui saber o número da Row
If Rw = DatumValue And Not .contains(Rw) Then .Add Rw
Next Rw
a:
.Sort
Me.CombiProjekt.List = Application.Transpose(.toarray())
End With

End Sub

Se tiverem outra ideia melhor agradeço pela ajuda,
Abraços
João Santos
Avatar do usuário
Por alexandrevba
Avatar
#20904
Boa noite!!

Favor ler as regras do fórum!!!
viewtopic.php?f=5&t=4
Regra nº 11:
Nós preferimos que os membros não façam postagens cruzadas (quando a mesma postagem é feita em diferentes fóruns). Mas quando isso ocorrer, os membros devem deixar claro os links para as postagens cruzadas.
Favor indicar as postagens cruzadas:
http://www.planilhando.com.br/forum/vie ... 10&t=23829
http://www.planilhando.com.br/forum/vie ... 10&t=23832


Att
Por UngerSantos
Posts
#21014
Aqui está a resolução para o meu problemas:
Código: Selecionar todos

Private Sub CombiProjekt_AfterUpdate()
Dim sn, sn1 As Variant
Dim Rw As Variant
Dim Projektnummer As String
Dim Row As Integer, Column As Integer
Dim Row1 As Integer, Column1 As Integer
Dim FirstColumn As String, SecondColumn As String
Projektnummer = Me.CombiProjekt.Value
sn = Sheets(2).Cells(Row, Column) 'Combibox Projekt Filter
sn1 = Sheets(2).Cells(Row1, Column1) 'Combibox Projekt Filter

Me.Comb_Datum.Value = ""
    
    With CreateObject("System.Collections.ArrayList") 'Combibox Datum Filter
        
        Do Until sn = ""
            FirstColumn = sn
            SecondColumn = sn1
            Row = Row + 1
            Row1 = Row1 + 1

            If sn = Projektnummer And Not .contains(SecondColumn) Then .Add SecondColumn 'Wert von SecondColumn
                sn = Sheets(2).Cells(Row, Column) 'Combibox Projekt Filter
                sn1 = Sheets(2).Cells(Row1, Column1) 'Combibox Projekt Filter
        Loop

        .Sort
        Me.Comb_Datum.List = Application.Transpose(.toarray())
        Me.Comb_Datum.ListIndex = 0
        Me.Comb_Datum.SetFocus
        SendKeys "%{Down}"
        
End With

End Sub
Abraços,
Obrigado a todos os que tentaram
João Santos
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