vba a code to print data from listbox

BLUEPOMME

New Member
Joined
Nov 15, 2018
Messages
22
hello i need a code for CommandButton1_Click That prints visible data from a listbox

so far i have as follow ....:confused:

Code:
Private Sub Cmd_00_Click()
  Unload Me
End Sub


Private Sub CommandButton1_Click()


End Sub




Private Sub T_00_Change()
Select Case C_00.Value
    Case "FECHA"
        LB_00.list = [Tabla1].Value
        For i = LB_00.ListCount - 1 To 0 Step -1
            If InStr(1, LB_00.list(i, 0), T_00, vbTextCompare) = 0 Then LB_00.RemoveItem (i)
        Next
    Case "HAB"
        LB_00.list = [Tabla1].Value
        For i = LB_00.ListCount - 1 To 0 Step -1
            If InStr(1, LB_00.list(i, 1), T_00, vbTextCompare) = 0 Then LB_00.RemoveItem (i)
        Next
    Case "CELEBRA"
        LB_00.list = [Tabla1].Value
        For i = LB_00.ListCount - 1 To 0 Step -1
            If InStr(1, LB_00.list(i, 3), T_00, vbTextCompare) = 0 Then LB_00.RemoveItem (i)
        Next
    Case "NOMBRE"
        LB_00.list = [Tabla1].Value
        For i = LB_00.ListCount - 1 To 0 Step -1
            If InStr(1, LB_00.list(i, 4), T_00, vbTextCompare) = 0 Then LB_00.RemoveItem (i)
        Next
    Case "LUGAR"
        LB_00.list = [Tabla1].Value
        For i = LB_00.ListCount - 1 To 0 Step -1
            If InStr(1, LB_00.list(i, 5), T_00, vbTextCompare) = 0 Then LB_00.RemoveItem (i)
        Next
    Case "DECO"
        LB_00.list = [Tabla1].Value
        For i = LB_00.ListCount - 1 To 0 Step -1
            If InStr(1, LB_00.list(i, 6), T_00, vbTextCompare) = 0 Then LB_00.RemoveItem (i)
        Next
    Case "SOLICITANTE"
        LB_00.list = [Tabla1].Value
        For i = LB_00.ListCount - 1 To 0 Step -1
            If InStr(1, LB_00.list(i, 7), T_00, vbTextCompare) = 0 Then LB_00.RemoveItem (i)
        Next
    Case Else
        MsgBox "SELECIONA POR CUAL COLUMNA BUSCAR", vbCritical, "©2018 MMEIER"
End Select
 For i = 0 To LB_00.ListCount - 1
    LB_00.list(i, 2) = Format(LB_00.list(i, 2), "hh:mm AM/PM")
Next i
    If LB_00.ListCount = 0 Then T_00.Value = Left(T_00.Value, Len(T_00.Value) - 1)
End Sub
Private Sub UserForm_Initialize()
HideTitleBar Me
C_00.list = Split("FECHA HAB CELEBRA NOMBRE LUGAR DECO SOLICITANTE")
With LB_00
    .ColumnCount = 8
    .ColumnWidths = "70;70;70;100;100;100;150;70"
    .list = Hoja2.ListObjects(1).DataBodyRange.Value
    For i = 0 To .ListCount - 1
        .list(i, 2) = Format(.list(i, 2), "hh:mm AM/PM")
    Next i
End With
End Sub
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Cross-posted here: https://www.excelforum.com/excel-programming-vba-macros/1253182-printing-data-from-listbox.html

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules). This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0
truly sorry ....you are very right ...thank you for your advise i don´t want having people working twice and loosing time in the same think ..in the future i will share links ...;)
 
Upvote 0

Forum statistics

Threads
1,214,415
Messages
6,119,375
Members
448,888
Latest member
Arle8907

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top