VBA Filter Names from List One by One and then Copy filtered data

Sufiyan97

Well-known Member
Joined
Apr 12, 2019
Messages
1,614
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
I have a data like below

I a VBA to Filter Names from List (J16:J20) One by One and then Copy the filtered data:

Book1
CDEFGHIJKL
1NameAmount
2A5
3A5
4B10
5B10
6C15
7C15
8D20
9D20
10E25
11E25
12
13Total Quantity150
14Total Amount4500
15
16A
17B
18C
19D
20E
21
22
23
24
25
Sheet1
Cell Formulas
RangeFormula
E13E13=SUBTOTAL(9,E2:E11)
E14E14=E13*30
 
Copying as image would be even simpler; for example:

Hey Anthony,

That is really amazing.

Didn't know that it would be simpler for you.

That is the thing which I was doing manually filtering and copying the data and sending to my brother for his monthly bills.

This is the thing which I wanted to do automatically.

A BIG THANK YOU for all your help.
 
Upvote 0

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Hi Anthony

What if I want to change the criteria column for example, currently it is filtering in names column in column D
I want to change the name column to E if the list of names is in column E.
Which line should I modify?
 
Upvote 0
Didn't understand what you wish to modify, but:
This set to D1 the start position for the filtered column
VBA Code:
Set fRange = Range(Range("D1"), Range("D1").End(xlDown).Offset(0, 1))

This set the start position for the names to Row 16 / Column J
VBA Code:
For I = 16 To 1000
    cFilt = Cells(I, "J").Value
("J" is also recalled in the Messagebox)

This extend the selection to the column at the left of the filtered column:
Rich (BB code):
Range(fRange.Cells(1, 0), etc etc

If this isn't sufficient for your situation then please describe again the request
 
Upvote 0
Hi Anthony
Thanks again

I modified below lines and this is working:
VBA Code:
Set fRange = Range(Range("E1"), Range("E1").End(xlDown).Offset(1, 0))   'Assuming the table starts in D1

VBA Code:
Range(fRange.Cells(1, -1), fRange.Cells(fRC + 3, fRange.Columns.Count)).Copy


So the question was like this if I interchange the Amount and name columns

Book2
CDE
1DateAmountName
29/28/20225A
39/28/20225A
41/1/190010B
59/29/202210B
69/30/202215C
79/30/202215C
810/1/202220D
910/1/202220D
101/1/190025E
1110/2/202225E
12
13150Total Quantity
144500Total Amount
Sheet1
Cell Formulas
RangeFormula
C4,C10C4=B3+1
D13D13=SUBTOTAL(9,D2:D11)
D14D14=D13*30
 
Upvote 0

Forum statistics

Threads
1,224,815
Messages
6,181,136
Members
453,021
Latest member
Justyna P

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