pedro-egoli
Well-known Member
- Joined
- Apr 25, 2004
- Messages
- 1,217
- Office Version
- 2016
- Platform
- Windows
The following macro which I recorded sorts the 10 highest values in a range and then produces a chart.
Just trying to work out how to make this macro autorun whenever a change is made to any cell .
Existing macro is
After searching found this suggestion
However, not sure how to incorporate it or in fact if it would work.
Any assistance appreciated.
Pedro
Just trying to work out how to make this macro autorun whenever a change is made to any cell .
Existing macro is
Code:
Sub Macro1()
'
' Macro1 Macro
'
'
'
Range("A1:A100").Select
Selection.Sort Key1:=Range("A1"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("A1:A10").Select
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:A10"), PlotBy _
:=xlColumns
ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1"
With ActiveChart
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
End Sub
After searching found this suggestion
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set r = Range("A1:A100")
If Intersect(t, r) Is Nothing Then Exit Sub
Application.EnableEvents = False
Call yoursub
Application.EnableEvents = True
End Sub
However, not sure how to incorporate it or in fact if it would work.
Any assistance appreciated.
Pedro