ADDING SEARCH BOX BY DATE TO MY CODES

tarik mokhtar 1 Reputation point
2021-10-05T13:03:33.51+00:00

dear all,
good greeting
i need to add a search box by date to my userform this is the code i need to add to it

Dim Litem As Long, LbRows As Long, LbCols As Long
Dim bu As Boolean
Dim Lbloop As Long, Lbcopy As Long

LbRows = ListBox1.ListCount - 1
LbCols = ListBox1.ColumnCount - 1

For Litem = 0 To LbRows
If ListBox1.Selected(Litem) = True Then
      bu = True
      Exit For
End If
Next

If bu = True Then
With Sheets("SelectedData").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)

        For Litem = 0 To LbRows
            If ListBox1.Selected(Litem) = True Then 'Row selected
              'Increment variable for row transfer range
              Lbcopy = Lbcopy + 1
        For Lbloop = 0 To LbCols
                   'Transfer selected row to relevant row of transfer range
        .Cells(Lbcopy, Lbloop + 1) = ListBox1.List(Litem, Lbloop)

       Next Lbloop
            End If
        Next
        For M = 0 To LbCols
            With Sheets("SelectedData").Cells(Rows.Count, 1).End(xlUp).Offset(0, M).Borders(xlEdgeBottom)
    .LineStyle = xlContinuous
    .Weight = xlMedium
    .ColorIndex = 30


    Dim WS As Worksheet

Set WS = Sheets("SelectedData")
Dim rowRng As Range
For Each rowRng In WS.UsedRange.Rows
BlanckCellsCount = WorksheetFunction.CountBlank(rowRng)
If BlanckCellsCount <> rowRng.Cells.Count Then
With rowRng
.Borders.Weight = xlThick
.Cells.VerticalAlignment = xlCenter
.Cells.HorizontalAlignment = xlCenter
End With
End If
Next rowRng

    End With

Next
End With

Else
     MsgBox "Nothing chosen", vbCritical
     Exit Sub








End If
Sheet3.Range("a:i").Cells.Font.Size = 40
Sheet3.Range("a:i").WrapText = True
Sheet3.Range("a:i").Cells.HorizontalAlignment = True


Sheet3.Range("A:I").ExportAsFixedFormat xlTypePDF, Filename:="TEST", OPENAFTERPUBLISH:=True

MsgBox "تم أنشاء التقرير", vbInformation
ListBox1.Clear

End Sub

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
4,141 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.