Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
tkraju via OfficeKB.com wrote:
I have date range in Col A:A.I need code that selects A2 to 3 months back date from today. Suppose 3 months back date is 9 th Dec 2006 and it exists in A15 cell ,the range to select is A2:A15.What code will give this result.Thanks for any help in this regard. Assuming the dates are in descending order and there are no blanks in your list of dates, this will select the range from A1 to the last cell with a date greater than Now() - 30 (days): ================= Sub dates() Dim MyDatesList As Range Set MyDatesList = Worksheets("Sheet1").Range("A1", _ Worksheets("Sheet1").Range("A2").End(xlDown)) For Each dt In MyDatesList If dt.Value Now() - 30 Then Worksheets("Sheet1").Range("A1", dt).Select Else End If Next dt End Sub ================== |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Code to conditional format all black after date specified in code? | Excel Discussion (Misc queries) | |||
Convert a julian gregorian date code into a regular date | Excel Worksheet Functions | |||
copy date based on date -refer to date range | Excel Programming | |||
VBA Code to extract records between a date range | Excel Programming | |||
date range vba code | Excel Programming |