• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

SPP Find Date in Table Column

S P P

Member
Good afternoon!

Find Date in Table Column

How would VBA Locate data in column1 of a table
 

Attachments

  • SPP Find Date in Table Column.xlsm
    36 KB · Views: 2
I got it like this

>>> as many times noted: <<<
>>> use code - tags <<<

Code:
Dim Tbl As ListObject
Dim Search As Date
Dim Rng As Range

       Search = Format(TextBox1.Value, "DD/MM/YYYY")

Set Tbl = ActiveSheet.ListObjects(1)

       On Error Resume Next
Set Rng = Tbl.DataBodyRange.Columns(1).Find(Search, LookAt:=xlWhole)
       On Error GoTo 0

    If Not Rng Is Nothing Then
       MsgBox "Date found successfully", vbQuestion, "successfully"
       Unload Me
       Rng.Select
     
Else
       MsgBox "The date cannot be found. try another?", vbInformation, "Not found"
       TextBox1.SetFocus
End If
 
>>> as many times noted: <<<
>>> use code - tags <<<
Code:
Search = Format(TextBox1.Value, "DD/MM/YYYY")
replace with
Code:
If TextBox1 <> "" Then Search = Format(TextBox1.Value, "DD/MM/YYYY")
 
Last edited by a moderator:
Back
Top