• 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.

By VBA how to extract table data to new sheet

vrunda

Member
I have data in excel table containing columns: date -: Receipts -: Challans -: Total


On new sheet I want data of table from date 01/04/2012 to 31/03/2013 i.e. financial year

Will sql be of help or For- next statement.


It needs to be mentioned that date column is not filled completely i.e. there may be blank cells in date column
 
Before going down that route, have you considered using the Advanced Filter? You could setup the dates and it's already designed to move/copy large amounts of data from a database based on multiple criteria.

http://www.contextures.com/xladvfilter01.html


If you really wanted, you could setup the filter, and then record a macro of you running the filter, which would achieve your desired end result, I believe.
 
I record macro for above using auto filter & then date criteria & ALso advance filter .

Code for advance filter is as below:

Sub copydata()

'

' copydata Macro

' TO COPY DATA ON ANOTHER SHEET ON GIVEN CRITERIA

'

' Keyboard Shortcut: Ctrl+Shift+F

'

Sheets("FEES 2011").Range("A7:L119").AdvancedFilter Action:=xlFilterCopy, _

CriteriaRange:=Sheets("FEES 2011").Range("I4:J5"), CopyToRange:=Range( _

"A3:L3"), Unique:=False

End Sub


Manually it worked fine but the code does not give any result.

Even auto filter code gave error of subscript out of range.


I am thinking to give a button on sheet to extract data as This is daily task .

But code of recorded macro does not work.
 
Back
Top