#1
|
|||
|
|||
Macro to tackle the dates.
Hi Everyone,
Could you please help me with the macro. I have a macro which converts the dates (Maturity date column in attached excel sheet) into text to columns and format it to Format cells --> Date-->14-mar-2001 which is working fine. Now i want the macro to delete entire columns of all rows which are greater than the variable date given in "Z". I have tried a macro but it is not working. It is taking ages to find the works or it is not correctly recognizing the dates. Here is my code till now and attached is the data file. It is fine if we can work it out with Auto filters or delete data row by row. Please help. Thanks in advance. Code:
Sub Macro1() Columns("M").Select Selection.TextToColumns Destination:=Range("M1"), DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, Tab:=True, FieldInfo:=Array(1, 4), TrailingMinusNumbers:=True Selection.NumberFormat = "[$-409]d-mmm-yyyy;@" Dim x As Date Dim LR As Long x = InputBox("Enter the from date in format MM/DD/YYYY") LR = Range("C" & Rows.Count).End(xlUp).Row For i = LR To 2 Step -1 If Cells(i, 13).Value > x Then Cells(i, 13).EntireRow.Delete End If Next i End Sub |
#2
|
||||
|
||||
Hi
Perhaps also post your sheet ? ( Click Go advanced - Manage attachments)
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
X axis graph all dates when date column contains specific dates..possible ? | DBenz | Excel | 2 | 03-28-2018 04:59 AM |
Macro or formula on Excel to Standardize dates | leonardo.sp05 | Excel | 7 | 02-13-2017 06:15 PM |
Autofill dates - how can I get the same date and consecutive dates? | Exhale | Excel | 3 | 04-05-2016 03:11 AM |
Not sure how to tackle this... | InfO | Excel | 2 | 01-11-2012 01:57 PM |
Automatically update dates using a macro | matthew544 | Word VBA | 5 | 12-06-2011 03:19 AM |