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.
#58333
Boa tarde,

Estou com uma pequena dificuldade de formatar o campo HORA no ListBox (aparece ela no valor decimal) e quando compila, aparece o erro em tempo de execução 381 (não foi possivel a propriedade List, algo do tipo). Vou colocar o código:

Private Sub UserForm_Initialize()

Dim linhaFinal, linha, x As Integer
Dim V As Double

ListBox1.Clear

linhaFinal = Planilha1.Cells(Rows.Count, 1).End(xlUp).Row

x = 0

For linha = 2 To linhaFinal
V = ListBox1.List(linha, 2)
ListBox1.AddItem Planilha1.Cells(linha, 1).Value

ListBox1.List(x, 1) = Format(Planilha1.Cells(linha, 2), V, "hh:mm").Value
ListBox1.List(x, 2) = Planilha1.Cells(linha, 3).Value
ListBox1.List(x, 3) = Planilha1.Cells(linha, 4).Value
ListBox1.List(x, 4) = Planilha1.Cells(linha, 5).Value
ListBox1.List(x, 5) = Planilha1.Cells(linha, 6).Value


x = x + 1

Next

End Sub

Alguém pode me ajudar?
Aguardo respostas!

[]'s
#58354
Código: Selecionar todos
Option Explicit

Private Sub UserForm_Activate()
    Dim lngLin      As Long
    Dim lngCol      As Long
    Dim rngInt      As Range
    
    With UserForm1.ListBox1
        .Clear
        
        With Planilha1
            lngLin = .Cells(.Rows.Count, 1).End(xlUp).Row
            lngCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
            Set rngInt = .Range(.Cells(2, 1), .Cells(lngLin, lngCol))
        End With
        .RowSource = rngInt.Address
    End With
End Sub
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