Ir ao conteúdo

coluna do listview no formato de hora


laercionb

Posts recomendados

Postado

Alguem poderia me ajudar a carregar os dados no listview em foramato "hh:mm"

ja pesquisei na net mas nao achei nada relacionado. por favor me ajudem...

Postado

Bom dia!!

Seria tipo...

.ListItems.Add , , Cell 
.ListItems(X).ListSubItems.Add , , Cell.Offset(0, 1)
.ListItems(X).ListSubItems.Add , , Format(Cell.Offset(0, 2), "hh:mm")
.ListItems(X).ListSubItems.Add , , Cell.Offset(0, 3)

Postado
Bom dia!!

Seria tipo...

.ListItems.Add , , Cell 
.ListItems(X).ListSubItems.Add , , Cell.Offset(0, 1)
.ListItems(X).ListSubItems.Add , , Format(Cell.Offset(0, 2), "hh:mm")
.ListItems(X).ListSubItems.Add , , Cell.Offset(0, 3)

olha esta é a macro que estou usando.

With lsLista

.Gridlines = True

.View = lvwReport

.FullRowSelect = True

.ColumnHeaders.Add Width:=5

.ColumnHeaders.Add Text:="DATA", Width:=60

.ColumnHeaders.Add Text:="HORA", Width:=60

.ColumnHeaders.Add Width:=5

.ColumnHeaders.Add Text:="DATA", Width:=60

.ColumnHeaders.Add Text:="HORA", Width:=60

.ColumnHeaders.Add Width:=5

.ColumnHeaders.Add Text:="DATA", Width:=60

.ColumnHeaders.Add Text:="HORA", Width:=60

.ColumnHeaders.Add Width:=5

.ColumnHeaders.Add Text:="DATA", Width:=60

.ColumnHeaders.Add Text:="HORA", Width:=60

.ColumnHeaders.Add Width:=5

.ColumnHeaders.Add Text:="DATA", Width:=60

.ColumnHeaders.Add Text:="HORA", Width:=60

.ColumnHeaders.Add Width:=5

.ColumnHeaders.Add Text:="DATA", Width:=60

.ColumnHeaders.Add Text:="HORA", Width:=60

.ColumnHeaders.Add Width:=5

.ColumnHeaders.Add Text:="DATA", Width:=60

.ColumnHeaders.Add Text:="HORA", Width:=60

.ColumnHeaders.Add Width:=5

.ColumnHeaders.Add Text:="DATA", Width:=60

.ColumnHeaders.Add Text:="HORA", Width:=60

.ColumnHeaders.Add Width:=5

.ColumnHeaders.Add Text:="DATA", Width:=60

.ColumnHeaders.Add Text:="HORA", Width:=60

.ColumnHeaders.Add Width:=5

.ColumnHeaders.Add Text:="DATA", Width:=60

.ColumnHeaders.Add Text:="HORA", Width:=60

.ColumnHeaders.Add Width:=5

End With

'Adiciona os itens no ListView

UltimaLinha = ActiveSheet.Cells(ActiveSheet.Cells.Rows.Count, "A").End(xlUp).Row

lsLista.ListItems.Clear

q = 0

For x = 1 To UltimaLinha

Set li = lsLista.ListItems.Add(Text:=ActiveSheet.Cells(x, "A").Value)

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "C").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "D").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "E").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "F").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "G").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "H").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "I").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "J").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "K").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "L").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "M").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "N").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "O").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "P").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "Q").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "R").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "S").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "T").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "U").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "V").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "W").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "X").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "Y").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "Z").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AA").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AB").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AC").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AD").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AE").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AF").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AG").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AH").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AI").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AJ").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AK").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AL").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AM").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AN").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AO").Value

q = q + 1

Next

lbQtdade = "Qtdade: " & q

MsgBox " DADOS CARREGADOS COM SUCESSO", vbInformation, "PB BRASIL"

Gostaria q aparece-se em formato de hora nao numero tentei adpatar a forma que me respondeu mas nao tive sucesso

post-1014004-13884965823284_thumb.jpg

Postado
olha esta é a macro que estou usando.

With lsLista

.Gridlines = True

.View = lvwReport

.FullRowSelect = True

.ColumnHeaders.Add Width:=5

.ColumnHeaders.Add Text:="DATA", Width:=60

.ColumnHeaders.Add Text:="HORA", Width:=60

.ColumnHeaders.Add Width:=5

.ColumnHeaders.Add Text:="DATA", Width:=60

.ColumnHeaders.Add Text:="HORA", Width:=60

.ColumnHeaders.Add Width:=5

.ColumnHeaders.Add Text:="DATA", Width:=60

.ColumnHeaders.Add Text:="HORA", Width:=60

.ColumnHeaders.Add Width:=5

.ColumnHeaders.Add Text:="DATA", Width:=60

.ColumnHeaders.Add Text:="HORA", Width:=60

.ColumnHeaders.Add Width:=5

.ColumnHeaders.Add Text:="DATA", Width:=60

.ColumnHeaders.Add Text:="HORA", Width:=60

.ColumnHeaders.Add Width:=5

.ColumnHeaders.Add Text:="DATA", Width:=60

.ColumnHeaders.Add Text:="HORA", Width:=60

.ColumnHeaders.Add Width:=5

.ColumnHeaders.Add Text:="DATA", Width:=60

.ColumnHeaders.Add Text:="HORA", Width:=60

.ColumnHeaders.Add Width:=5

.ColumnHeaders.Add Text:="DATA", Width:=60

.ColumnHeaders.Add Text:="HORA", Width:=60

.ColumnHeaders.Add Width:=5

.ColumnHeaders.Add Text:="DATA", Width:=60

.ColumnHeaders.Add Text:="HORA", Width:=60

.ColumnHeaders.Add Width:=5

.ColumnHeaders.Add Text:="DATA", Width:=60

.ColumnHeaders.Add Text:="HORA", Width:=60

.ColumnHeaders.Add Width:=5

End With

'Adiciona os itens no ListView

UltimaLinha = ActiveSheet.Cells(ActiveSheet.Cells.Rows.Count, "A").End(xlUp).Row

lsLista.ListItems.Clear

q = 0

For x = 1 To UltimaLinha

Set li = lsLista.ListItems.Add(Text:=ActiveSheet.Cells(x, "A").Value)

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "C").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "D").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "E").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "F").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "G").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "H").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "I").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "J").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "K").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "L").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "M").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "N").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "O").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "P").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "Q").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "R").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "S").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "T").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "U").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "V").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "W").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "X").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "Y").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "Z").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AA").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AB").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AC").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AD").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AE").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AF").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AG").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AH").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AI").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AJ").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AK").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AL").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AM").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AN").Value

li.ListSubItems.Add Text:=ActiveSheet.Cells(x, "AO").Value

q = q + 1

Next

lbQtdade = "Qtdade: " & q

MsgBox " DADOS CARREGADOS COM SUCESSO", vbInformation, "PB BRASIL"

Gostaria q aparece-se em formato de hora nao numero tentei adpatar a forma que me respondeu mas nao tive sucesso

ja resolvi foi simples para formatar a coluna em formato de hora so selecionei a coluna e ficou assim

li.ListSubItems.Add Text:=Format(ActiveSheet.Cells(x, "D").Value, "hh:mm")

  • Membro VIP
Postado

Caso o autor do tópico necessite, o mesmo será reaberto, para isso deverá entrar em contato com a moderação solicitando o desbloqueio.

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...

Ebook grátis: Aprenda a ler resistores e capacitores!

EBOOK GRÁTIS!

CLIQUE AQUI E BAIXE AGORA MESMO!