Quitar encabezado de listbox excel vba

[Buen día dante, una ayuda más de la macro anterior.

Filtrar Fecha por mes según condición excel vba

Los encabezados lo hice con label

¿Cuándo no encuentra ningún dato en el filtro me sale los encabezados en el listbox como lo quito?

en form activate puse 

ListBox1.ColumnHeads = False

1 Respuesta

Respuesta
1

Te anexo la macro actualizada

'
Private Sub CommandButton1_Click()
'Por.Dante Amor
    Set h1 = Sheets("CRON-CLI")
    Set h2 = Sheets("reporte")
    Set h3 = Sheets("Hoja1")    'hoja con nombres
    '
    ListBox1.RowSource = ""
    If ComboBox1 = "" Or ComboBox1.ListIndex = -1 Then
        MsgBox "Selecciona el mes"
        Exit Sub
    End If
    h2.Rows("4:" & Rows.Count).ClearContents
    j = 4
    For i = 4 To h1.Range("D" & Rows.Count).End(xlUp).Row
        If ComboBox1.ListIndex = 0 Then mes = Month(h1.Cells(i, "D")) Else mes = ComboBox1.ListIndex
        If Month(h1.Cells(i, "D")) = mes And h1.Cells(i, "H") = "PENDIENTE" Then
            h2.Cells(j, "A") = h1.Cells(i, "C")
            h2.Cells(j, "B") = h1.Cells(i, "B")
            cod = Split(h1.Cells(i, "B"), "-")
            If UBound(cod) = 1 Then
                numcod = cod(1)
                Set b = h3.Columns("D").Find(numcod, lookat:=xlWhole)
                If Not b Is Nothing Then
                    h2.Cells(j, "C") = h3.Cells(b.Row, "B") 'nombre
                    h2.Cells(j, "D") = h3.Cells(b.Row, "H") 'tel
                    h2.Cells(j, "E") = h3.Cells(b.Row, "I") 'dir
                End If
            End If
            h2.Cells(j, "F") = h1.Cells(i, "D")
            h2.Cells(j, "H") = h1.Cells(i, "G")
            h2.Cells(j, "I") = h1.Cells(i, "H")
            j = j + 1
        End If
    Next
    u = h2.Range("F" & Rows.Count).End(xlUp).Row
    If u < 4 Then u = 4
    rango = h2.Range("A4:I" & u).Address
    ListBox1.RowSource = h2.Name & "!" & rango
End Sub

sal u dos

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas