• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Import Text file and filter data as per date

prsnthkrishna

New Member
I have a text file with huge data saved in folder. I need to import that text file into excel and I need to filter only latest 3 months (current month and previous two months).
I have done record macro and made some changes in December. In this month, again I need to make changes like changing the month December as March. Every month I can't make changes. Can any one please help me how to fix these months without changing again and again.

Since the macro code is huge, i am not able to enter here. Please find two files in below link.


Awaiting for your reply.

Thanks,
Prashanth
 

Marc L

Excel Ninja
As an import text file VBA procedure needs few codelines, create at least a smaller sample text file to import​
- use for example Notepad++ to 'cut' the original text file -​
and according to this new sample text file create the expected result workbook, attach both files here …​
 

prsnthkrishna

New Member
Hi Marc, The vba code for importing (Exclusion text file) is available in another text file. since the code is huge, i uploaded it in text format.
 

Marc L

Excel Ninja
So in this case just activate the Macro Recorder and operate manually to filter the data to delete :​
you will get your own code base to amend your original VBA procedure …​
 

prsnthkrishna

New Member
YEah., I did using macro recorder. And it is working fine.. But the problem is I need to change name of month manually every month. Because I need to extract data only for 3 months. Jan, Feb and March. Next month I need only for Feb, March and April. and so on..
 
Last edited by a moderator:

Marc L

Excel Ninja
Without any crystal clear elaboration maybe :​
Code:
Sub Demo00()
    MsgBox Format(Date, "mmmm")
    MsgBox Format(DateAdd("m", -2, Date), "mmmm")
End Sub
Do you like it ? So thanks to click on bottom right Like !
 
Top