![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
MrExcel MVP
Join Date: Feb 2002
Location: San Francisco, California USA
Posts: 10,387
|
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 |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|