selecting rows based on date in column
Prep for a pre-employment Excel test with Job Test Prep
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: selecting rows based on date in column

  1. #1
    Guest

    Default

     
    Can somebody help me write a macro to do the following:

    To check for current date in a prticular column cell by cell and if found to select the entire row.

    Thank you.

  2. #2
    MrExcel MVP Tom Urtis's Avatar
    Join Date
    Feb 2002
    Location
    San Francisco, California USA
    Posts
    11,136
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Well I can't resist, this is so similar to the question 15 minutes ago. Assumes your date is in column A...here's your macro:

    Sub SelectDate()
    Dim theCol As Range, cell As Range, RtoSel As Range
    Dim LtoSel As String
    Set theCol = Range(Range("A1"), Range("A65536").End(xlUp))
    LtoSel = Date
    For Each cell In theCol
    If cell = LtoSel Then
    If RtoSel Is Nothing Then
    Set RtoSel = cell
    Else
    Set RtoSel = Application.Union(RtoSel, cell)
    End If
    End If
    Next
    On Error GoTo e
    RtoSel.EntireRow.Select
    Exit Sub
    e:
    MsgBox "There is nothing to select.", vbInformation, "How about that!"
    End Sub


    Tom Urtis

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com