Cambiar formato a Columnas ListBox formato hora y fecha

Para este código necesito que las columnas G sea formato Hora y la Columna DE en formato Moneda.

Private Sub BusquedaManual_Click()    Call EliminarContenido    '    Set r = Columns("A")    Set b = r.Find(BusquedaTxt, lookat:=xlPart)    If Not b Is Nothing Then        ncell = b.Address        Do            'detalle            ContenidoRol.AddItem Cells(b.Row, "A")            ContenidoRol.List(ContenidoRol.ListCount - 1, 1) = Cells(b.Row, "B")            ContenidoRol.List(ContenidoRol.ListCount - 1, 2) = Cells(b.Row, "C")            ContenidoRol.List(ContenidoRol.ListCount - 1, 3) = Cells(b.Row, "D")            ContenidoRol.List(ContenidoRol.ListCount - 1, 4) = Cells(b.Row, "E")            ContenidoRol.List(ContenidoRol.ListCount - 1, 5) = Cells(b.Row, "F")            ContenidoRol.List(ContenidoRol.ListCount - 1, 6) = Cells(b.Row, "G")            ContenidoRol.List(ContenidoRol.ListCount - 1, 7) = Cells(b.Row, "H")            Set b = r.FindNext(b)        Loop While Not b Is Nothing And b.Address <> ncell    End If    '    Sheets("Hoja1").SelectEnd Sub

1 Respuesta

Respuesta
1

Te anexo la macro actualizada

Private Sub BusquedaManual_Click()
    Call EliminarContenido
    '
    Set r = Columns("A")
    Set b = r.Find(BusquedaTxt, lookat:=xlPart)
    If Not b Is Nothing Then
        ncell = b.Address
        Do
            'detalle
            ContenidoRol.AddItem Cells(b.Row, "A")
            ContenidoRol.List(ContenidoRol.ListCount - 1, 1) = Cells(b.Row, "B")
            ContenidoRol.List(ContenidoRol.ListCount - 1, 2) = Cells(b.Row, "C")
            ContenidoRol.List(ContenidoRol.ListCount - 1, 3) = Cells(b.Row, "D")
            ContenidoRol.List(ContenidoRol.ListCount - 1, 4) = Cells(b.Row, "E")
            ContenidoRol.List(ContenidoRol.ListCount - 1, 5) = Cells(b.Row, "F")
            ContenidoRol.List(ContenidoRol.ListCount - 1, 6) = Format(Cells(b.Row, "G"), "hh:mm")
            ContenidoRol.List(ContenidoRol.ListCount - 1, 7) = Format(Cells(b.Row, "H"), "$ #,#00.00")
            Set b = r.FindNext(b)
        Loop While Not b Is Nothing And b.Address <> ncell
    End If
    '
    Sheets("Hoja1").Select
End Sub

Saludos.Dante Amor

Recuerda valorar la respuesta.

Muchas Gracias por la pronta respuesta saludos.! 

Estimado:

¿Para este mismo tipo de búsqueda si el valor que busco se encuentra en dos columnas C y DE se puede realizar?

Prueba con esto:

Cambia esta línea

Set r = Columns("A")

Por esta

Set r = Columns("C:D")

Lo ultimo como puedo hacerlo para buscar si es una fecha?

Tienes que pasar el dato del textbox a una variable de fecha, por ejemplo

Dim fec As Date
fec = BusquedaTxt
Set b = r.Find(fec, lookat:=xlPart)

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas