filter and copy specific data

Haree

Board Regular
Joined
Sep 22, 2019
Messages
146
Office Version
  1. 2016
Hello All,
I have an excel sheet which has around 15 sheets, out of which three sheets would not be used for this particular purpose. In the remaining 12 sheets i have the following Columns starting from Column "A" respectively

DateCategoryNameParticularsSINPiecesWeightDebit AmountCredit AmountOld GOld S

The column used for filtering is "Category" or 2nd Column. It has around 20 categories. But i would like it to filter out specific category called "Debtors" and copy the contents of Column A,B,C,D,H

and paste it to a different sheet which goes by the name receivables
Data should be pasted from Row 3 (Row 1 is header and Row 2 is intentionally left Blank)
The Destination worksheet has the following Columns starting from Column A Respectively.
DateCategoryNameParticularsAmount

Please Note : The Destination worksheet should be cleared of its contents expect for Headings and then paste the data every time i run the code And Category field for filtering data will have blanks at certain instances.

Any help would be greatly appreciated . Thanks for taking time to read this
 
New Microsoft Excel Worksheet.xlsx
This Excel file itself has sir. The debtors received value should reflect in a different column and the value of Debtors should reflect in a different column
Sorry for the trouble.
 
Upvote 0

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
@Haree, OK so you need the Dr & Cr reversed for Category = "Debtors Received".

At the end of the code just before the End Sub add this:-

VBA Code:
    ' For Category = Debtors Received swap debit and credit amounts
    Dim arrDest As Variant
    Dim i As Long
    Dim DrAmt As Variant, CrAmt As Variant          ' Used Variant to cater for empty cell
    arrDest = rngDest.Value
    
    For i = 2 To UBound(arrDest)
        If arrDest(i, 2) = "Debtors Received" Then
            DrAmt = arrDest(i, 5)
            CrAmt = arrDest(i, 6)
            arrDest(i, 5) = CrAmt
            arrDest(i, 6) = DrAmt
        End If
    Next i
    rngDest.Value = arrDest
 
Upvote 0

Forum statistics

Threads
1,214,636
Messages
6,120,669
Members
448,977
Latest member
moonlight6

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top