copy paste filtered list from column B: to A: in vba

lefty38

Board Regular
Joined
Oct 27, 2005
Messages
85
I have a list of cells - when I filter on emp_type for Manager in column C
I can select all of the cells in column B then click on the "green dot" in the green select box and drag it (Fill_Left) over to column A - copying the filtered text to column A

How can this be accomplished in VBA?

other info
excel 2013
rows of data can be any length

Thank you for the help this forum provides

beginning table
Mgr
Employee
Pay Code
Emp_Id
Michael
Christopher
Employee
046
Tom
Travis
Employee
146
Nikhil
Joel
Manager
244
Joel
Robbie
Employee
175
Christopher
Stanton
Manager
712
Christopher
Stanton
Manager
712
Michael
Ronald
Employee
795
Michael
Harry
Employee
773
Mark
Edward
Manager
161
Mark
Edward
Manager
161
Tan
Paul
Employee
815
Kevin
Justin
Employee
127

<tbody>
</tbody>

Desired output

only the Employee name was copied to Manager name where filtered (Manager) data was selected
Mgr
Employee
Pay Code
Emp_Id
Michael
William
Employee
150
Michael
Christopher
Employee
046
Tom
Travis
Employee
146
Joel
Joel
Manager
244
Joel
Robbie
Employee
175
Stanton
Stanton
Manager
712
Stanton
Stanton
Manager
712
Michael
Ronald
Employee
795
Michael
Harry
Employee
773
Edward
Edward
Manager
161
Edward
Edward
Manager
161
Tan
Paul
Employee
815
Tan
Paul
Employee
815
Kevin
Justin
Employee
127

<tbody>
</tbody>
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
In my description emp_type should be pay cd in column C
the green dot is located in the lower right corner of a selected cell

do I need to better describe the scenario ?
Thanks
 
Upvote 0
How about
Code:
Sub FillLft()

    Dim UsdRws As Long
    
    UsdRws = Range("C" & Rows.Count).End(xlUp).Row

    Columns(3).AutoFilter
    Range("C1:C" & UsdRws).AutoFilter Field:=1, Criteria1:="Manager"
    Range("A2:B" & UsdRws).FillLeft
    Columns(3).AutoFilter
    
End Sub
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,036
Messages
6,122,794
Members
449,095
Latest member
m_smith_solihull

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