Run a Macro when a cell is changed

tigerdel

New member
Joined
Aug 23, 2012
Messages
40
Reaction score
0
Points
0
Location
Cambridgeshire
Excel Version(s)
Office 365
Good Day to you all

I have a dilema

I have this code:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$2" Then
Sheets("Sales").Range("All_Data").AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Range("Criteria"), _
CopyToRange:=Range("Extract"), _
Unique:=False
End If
End Sub

It is in Sheet = Company

I also need to run the same code in Sheet = Broker and also Sheet = Party

I built the same code but changed it to meet the requirements of the Sheet [Broker]:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$2" Then
Sheets("Sales").Range("DATA").AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("Broker").Range("Criteria_Broker"), _
CopyToRange:=Sheets("Broker").Range("Extract_Broker"), _
Unique:=False
End If
End Sub

The named ranges are built but although I receive no errors, no data is populated in Sheet [Broker]

Any ideas because I am now completely frustrated

Thanks for looking

I can share the workbook if anyone wants it
 
To clarify:
The first code works absolutely fine in the Company sheet but the second code does not fill the sheet and gives no errors
 
Is that second code in the "Broker" sheet module?
 
CROSS POST

This question has been posted in at least one other forum.
Do not post any further responses in this thread until a link has been provided to these cross posts.

Whilst we would rather you didn't cross-post, we know that there may be a valid reason for doing so. All we ask is that you provide the links in your original post to your question in the other forum(s). Read this to understand why: https://www.excelguru.ca/content.php?184

This forum is full of volunteers that give up their own time to help others, something that should be respected and not taken for granted. It’s never nice for someone to find out that a problem they have spent time solving for you has already been answered somewhere else without them knowing, and so we ask you to make it clear that you have also asked elsewhere.
Please provide the link(s). If you are unable to do so, tell us where else you have posted this query.
 
Back
Top