Filter sort in using VBA

tojomojo

New Member
Joined
Feb 8, 2019
Messages
31
I've got a simple spread sheet where I am using a pull down box list to select a staff member and then all their sorted tasks should appear on another sheet. It just doesn't populate the target sheet (sheet 4).....

VBA attached to sheet with all tasks and pull down is;

Private Sub Worksheet_Change(ByVal Target As Range)
'Updateby Extendoffice
On Error Resume Next
If Not Intersect(Range("E2"), Target) Is Nothing Then
Application.EnableEvents = False
If Range("E2").Value = "" Then
Worksheets("Sheet4").ShowAllData
Else
Worksheets("Sheet4").Range("E2").AutoFilter 5, Range("E2").Value
End If
Application.EnableEvents = True
End If
End Sub
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

tojomojo

New Member
Joined
Feb 8, 2019
Messages
31
Forgot to mention the pull down is at cell E2 and the column to sort is column 5. This just doesn't seem to run???
 

tojomojo

New Member
Joined
Feb 8, 2019
Messages
31
Can anyone please help me with this. I am new to VB and I just cant work out why it isn't happenning
 

vcoolio

Well-known Member
Joined
Jun 29, 2014
Messages
1,079
Hello Tojomojo,

Could you please upload a sample of your workbook to a file sharing site (such as Drop Box or GE.TT) and then post the link to your file back here.
Please ensure that the sample is an exact replica of your actual workbook and if your data is sensitive then please use dummy data. A dozen or so rows of data will suffice.

Seeing your workbook and its set out will make it easier for someone to help you.

Cheerio,
vcoolio.
 

vcoolio

Well-known Member
Joined
Jun 29, 2014
Messages
1,079
Hello Tojomojo,

The link is telling me that the file can't be accessed. Could you try another file sharing site please. Perhaps GE.TT.

Cheerio,
vcoolio.
 

MARK858

MrExcel MVP
Joined
Nov 12, 2010
Messages
14,050
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
  2. Mobile
First of all you don't have a sheet
Worksheets("Sheet4")
, you have a sheet with the codename Sheet4 which is Worksheets("My List").

An explanation of the difference is in the link here.

Worksheets("My List") is blank and you are doing nothing in the code to copy/transfer any data to the sheet.

Can you please describe in words exactly what you want the code to do.
 

tojomojo

New Member
Joined
Feb 8, 2019
Messages
31
OK, so when the pulldown in E2 is selected on the TASKS sheet I want all the row data on that sheet that is associated with the selection in E2 to appear on the My Tasks sheet

Thanks
 

MARK858

MrExcel MVP
Joined
Nov 12, 2010
Messages
14,050
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
  2. Mobile
You don't have a "My Tasks" sheet!
and when we have it sorted on which sheet the data is going to, do you need the header copied? and the next time you run the code are you adding to the data already there or are you creating new data each time?
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,129,754
Messages
5,638,170
Members
417,011
Latest member
Amaden95

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
Top