Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-09-2018, 06:39 PM
boddulus boddulus is offline Macro to tackle the dates. Windows 8 Macro to tackle the dates. Office 2010 32bit
Novice
Macro to tackle the dates.
 
Join Date: Apr 2018
Posts: 2
boddulus is on a distinguished road
Default 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
Reply With Quote
  #2  
Old 07-09-2018, 11:47 PM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline Macro to tackle the dates. Windows 7 64bit Macro to tackle the dates. Office 2010 64bit
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,771
Pecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant future
Default

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
Reply With Quote
Reply



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
Macro to tackle the dates. Automatically update dates using a macro matthew544 Word VBA 5 12-06-2011 03:19 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:37 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft