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

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
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???
 
Upvote 0
Can anyone please help me with this. I am new to VB and I just cant work out why it isn't happenning
 
Upvote 0
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.
 
Upvote 0
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.
 
Upvote 0
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.
 
Upvote 0
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
 
Upvote 0
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:
Upvote 0

Forum statistics

Threads
1,214,667
Messages
6,120,818
Members
448,990
Latest member
rohitsomani

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