Notifications
Clear all

Listbox - Limite de 10 colunas

16 Posts
3 Usuários
0 Reactions
4,870 Visualizações
(@chook)
Posts: 197
Reputable Member
Topic starter
 

Bom dia,
tem como o Listbox apresentar mais que 10 colunas?

Já altereio o Columncount = 11, 12, etc porém só apresenta 10 colunas. :|

Alguma dica?

 
Postado : 21/03/2012 6:43 am
(@m_araujo)
Posts: 159
Estimable Member
 

Caro chook
Alem do ColumnCount vc tambem deve configura o RouwSource tipo limito minha a PLAN1 para mostra somente coluna A, B e C em ColumnCount eu coloco 3 Colunas okei
em RouwSouver coloco PLAN1!A1:C100 se eu mudar para mais colunas somente no ColumnCount e nao mudar em RowSoucer fica relamente errado
se atente ai na suas Lisbox e configura dessa forma que vai funcionar

At.
Araujo

' Se a resposta lhe ajudou coloque resolvido no poste e clique na Mãozinha'

 
Postado : 21/03/2012 6:56 am
(@chook)
Posts: 197
Reputable Member
Topic starter
 

Mas minha RowSoucer está em branco. Há um código que alimenta o Listbox conforme abaixo:


Private Sub Pesquisa_Cliente()
    Dim UltimaLinha, i, z As Integer
    Dim Soma, Soma2, Soma3 As Double
    
ListBox1.ColumnCount = 12

If historico.Value = False Then
    
    
    UltimaLinha = Sheets("Pedidos").Cells(Cells.Rows.Count, 1).End(xlUp).Row
    If UltimaLinha < 3 Then UltimaLinha = 3
    ListBox1.Clear
    
            ListBox1.AddItem Sheets("Pedidos").Range("A1").Value
            ListBox1.List(ListBox1.ListCount - 1, 1) = Sheets("Pedidos").Range("B1").Value
            ListBox1.List(ListBox1.ListCount - 1, 2) = Sheets("Pedidos").Range("F1").Value
            ListBox1.List(ListBox1.ListCount - 1, 3) = Sheets("Pedidos").Range("H1").Value
            ListBox1.List(ListBox1.ListCount - 1, 4) = Sheets("Pedidos").Range("I1").Value
            ListBox1.List(ListBox1.ListCount - 1, 5) = Sheets("Pedidos").Range("K1").Value
            ListBox1.List(ListBox1.ListCount - 1, 6) = Sheets("Pedidos").Range("L1").Value
            ListBox1.List(ListBox1.ListCount - 1, 7) = Sheets("Pedidos").Range("M1").Value
            ListBox1.List(ListBox1.ListCount - 1, 8) = Sheets("Pedidos").Range("R1").Value
            ListBox1.List(ListBox1.ListCount - 1, 9) = Sheets("Pedidos").Range("S1").Value
            ListBox1.List(ListBox1.ListCount - 1, 9) = Sheets("Pedidos").Range("S1").Value

    
    For i = 1 To UltimaLinha
            If Range("C" & i).Value = cmbxCliente.Value And Range("M" & i).Value <> "ENTREGUE E PAGO" Then

            ListBox1.AddItem Sheets("Pedidos").Range("A" & i).Value
            ListBox1.List(ListBox1.ListCount - 1, 1) = Sheets("Pedidos").Range("B" & i).Value
            ListBox1.List(ListBox1.ListCount - 1, 2) = Sheets("Pedidos").Range("F" & i).Value
            ListBox1.List(ListBox1.ListCount - 1, 3) = Sheets("Pedidos").Range("H" & i).Value
            ListBox1.List(ListBox1.ListCount - 1, 4) = Sheets("Pedidos").Range("I" & i).Value
            ListBox1.List(ListBox1.ListCount - 1, 5) = Sheets("Pedidos").Range("K" & i).Value
            ListBox1.List(ListBox1.ListCount - 1, 6) = Sheets("Pedidos").Range("L" & i).Value
            ListBox1.List(ListBox1.ListCount - 1, 7) = Sheets("Pedidos").Range("M" & i).Value
            ListBox1.List(ListBox1.ListCount - 1, 8) = Sheets("Pedidos").Range("R" & i).Value
            ListBox1.List(ListBox1.ListCount - 1, 9) = Sheets("Pedidos").Range("S" & i).Value
            ListBox1.List(ListBox1.ListCount - 1, 9) = Sheets("Pedidos").Range("S" & i).Value
            Soma = Soma + Val(Range("L" & i).Value)
                        If Range("AD" & i).Value = "Pedido Atrasado" Then
                            ListBox1.ForeColor = &HFF&
                        Else
                            ListBox1.ForeColor = &H80000008
                        End If
        End If
    Next
    
Else

    UltimaLinha = Sheets("Pedidos").Cells(Cells.Rows.Count, 1).End(xlUp).Row
    If UltimaLinha < 3 Then UltimaLinha = 3
    ListBox1.Clear
    
            ListBox1.AddItem Sheets("Pedidos").Range("A1").Value
            ListBox1.List(ListBox1.ListCount - 1, 1) = Sheets("Pedidos").Range("B1").Value
            ListBox1.List(ListBox1.ListCount - 1, 2) = Sheets("Pedidos").Range("F1").Value
            ListBox1.List(ListBox1.ListCount - 1, 3) = Sheets("Pedidos").Range("H1").Value
            ListBox1.List(ListBox1.ListCount - 1, 4) = Sheets("Pedidos").Range("I1").Value
            ListBox1.List(ListBox1.ListCount - 1, 5) = Sheets("Pedidos").Range("K1").Value
            ListBox1.List(ListBox1.ListCount - 1, 6) = Sheets("Pedidos").Range("L1").Value
            ListBox1.List(ListBox1.ListCount - 1, 7) = Sheets("Pedidos").Range("M1").Value
            ListBox1.List(ListBox1.ListCount - 1, 8) = Sheets("Pedidos").Range("R1").Value
            ListBox1.List(ListBox1.ListCount - 1, 9) = Sheets("Pedidos").Range("S1").Value

    
    For i = 1 To UltimaLinha
            If Range("C" & i).Value = cmbxCliente.Value Then

            ListBox1.AddItem Sheets("Pedidos").Range("A" & i).Value
            ListBox1.List(ListBox1.ListCount - 1, 1) = Sheets("Pedidos").Range("B" & i).Value
            ListBox1.List(ListBox1.ListCount - 1, 2) = Sheets("Pedidos").Range("F" & i).Value
            ListBox1.List(ListBox1.ListCount - 1, 3) = Sheets("Pedidos").Range("H" & i).Value
            ListBox1.List(ListBox1.ListCount - 1, 4) = Sheets("Pedidos").Range("I" & i).Value
            ListBox1.List(ListBox1.ListCount - 1, 5) = Sheets("Pedidos").Range("K" & i).Value
            ListBox1.List(ListBox1.ListCount - 1, 6) = Sheets("Pedidos").Range("L" & i).Value
            ListBox1.List(ListBox1.ListCount - 1, 7) = Sheets("Pedidos").Range("M" & i).Value
            ListBox1.List(ListBox1.ListCount - 1, 8) = Sheets("Pedidos").Range("R" & i).Value
            ListBox1.List(ListBox1.ListCount - 1, 9) = Sheets("Pedidos").Range("S" & i).Value
            Soma = Soma + Val(Range("L" & i).Value)
                        If Range("AD" & i).Value = "Pedido Atrasado" Then
                            ListBox1.ForeColor = &HFF&
                        Else
                            ListBox1.ForeColor = &H80000008
                        End If
        End If
    Next

End If
    
    Label3.Caption = Format(Soma, "R$ " & "#,##0.00")

    For i = 1 To UltimaLinha
        If Range("C" & i).Value = cmbxCliente.Value And Range("M" & i).Value = "ENTREGUE" Then
            Soma2 = Soma2 + Val(Range("L" & i).Value)
        End If
    Next

    Label4.Caption = Format(Soma2, "R$ " & "#,##0.00")

    For i = 1 To UltimaLinha
        If Range("C" & i).Value = cmbxCliente.Value And Range("M" & i).Value = "EM ANDAMENTO" Then
            Soma3 = Soma3 + Val(Range("L" & i).Value)
        End If
    Next

    Label6.Caption = Format(Soma3, "R$ " & "#,##0.00")
    
    For i = 1 To UltimaLinha
        If Range("C" & i).Value = cmbxCliente.Value And Range("M" & i).Value = "PRODUZIDO" Then
            Soma4 = Soma4 + Val(Range("L" & i).Value)
        End If
    Next

    Label9.Caption = Format(Soma4, "R$ " & "#,##0.00")
    
End Sub
 
Postado : 21/03/2012 7:08 am
(@chook)
Posts: 197
Reputable Member
Topic starter
 

Quando coloco o código abaixo, apresenta o erro "Erro em tempo de execução '380': Não foi possível definir a propriedade List. Valor de propriedade inválido."

ListBox1.List(ListBox1.ListCount - 1, 10) = Sheets("Pedidos").Range("S1").Value

 
Postado : 21/03/2012 7:12 am
(@m_araujo)
Posts: 159
Estimable Member
 

Posta a sua planilha ai seria bem mais interesante
at.
Araujo

 
Postado : 21/03/2012 7:33 am
(@chook)
Posts: 197
Reputable Member
Topic starter
 

Bom dia Araujo,

o link para a planilha <font><font> http://www.sendspace.com/file/c0ujpu</font></font>

Selecione o cliente e clique em pesquisar. O que preciso e que seja exibido no Listbox seja apresentado na ultima coluna o valor da Rota, que está na coluna "Q"

 
Postado : 21/03/2012 7:43 am
(@m_araujo)
Posts: 159
Estimable Member
 

Caro Chook
adiciona sua planilha aqui no forum mesmo
para adicionar o seu arquivo aqui vc deve compactar o mesmo
clique em responde mais abaixo tem algumas opçoes e la vc vai ver que tem uma ABA com o nome ADICIONAR UM ANEXO
pronto o resto e mais facil que abrir o Excel.

At.
Araujo

 
Postado : 21/03/2012 8:17 am
(@fernandofernandes)
Posts: 43750
Illustrious Member
 

Questão postada no fortum abaixo :

Qual o tamanho da propriedade List ?
Mensagempor Guima » Sex Abr 09, 2010 10:37 pm
O tamanho da propriedade List do Listbox é no máximo 9 ? Pois ele funciona perfeitamente até Listbox.List(i, 9), mas se colocar o 10...ai da erro informando que nao é possível definir a propriedade List. Alguém saberia me informar ?

http://www.tomasvasquez.com.br/forum/vi ... unas#p1170

[]s

 
Postado : 21/03/2012 8:50 am
(@chook)
Posts: 197
Reputable Member
Topic starter
 

Segue planilha

 
Postado : 21/03/2012 12:09 pm
(@fernandofernandes)
Posts: 43750
Illustrious Member
 

Da uma conferida...
viewtopic.php?f=23&t=2187&hilit=+LISTBOX
Mauro nem respondi, vergonha...

 
Postado : 21/03/2012 12:40 pm
(@fernandofernandes)
Posts: 43750
Illustrious Member
 

Anderson, blz

nossa cara, não vou ficar chateado de não ter retornado, mas quando vi este tópico do chook sabia que já havia respondido em algum dos foruns que participo, e nem pesquisei no Planilhando (falha minha), fui direto no Forum do Tomaz.

Valeu pela lembrança.

[]s

 
Postado : 21/03/2012 12:48 pm
(@fernandofernandes)
Posts: 43750
Illustrious Member
 

Só...
É que na mesma epoca vc me ensinou algumas coisas de listview
depois aprendi mais um pouquinho aqui mesmo com o joseA que abandonei de vez o listbox...

 
Postado : 21/03/2012 1:37 pm
(@chook)
Posts: 197
Reputable Member
Topic starter
 

Anderson, valeu a força, vou aprender o Listview e mudar meu código!

Grato a todos!

 
Postado : 22/03/2012 4:55 am
(@fernandofernandes)
Posts: 43750
Illustrious Member
 

Pessoal, isso então foi ou não foi resolvido?
Digo, a solução foi mesmo a troca de ListBox para ListView ?

:(

 
Postado : 22/08/2012 10:26 am
(@chook)
Posts: 197
Reputable Member
Topic starter
 

Foi, infelizmente não tem como no listbox

 
Postado : 22/08/2012 1:14 pm
Página 1 / 2