The following code only executes after I update the relevant cell (U8) if I click anywhere on the sheet.
Any ideas on how I can get it to execute automatically after I update this cell?
Thanks.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim celltxt As String
celltxt = ActiveSheet.Range("U8").Text
If InStr(1, celltxt, "Calendar Year") Then
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.PlotArea.Select
ActiveChart.SetSourceData Source:=Range("B13:G15")
Else
If InStr(1, celltxt, "Half Year") Then
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.PlotArea.Select
ActiveChart.SetSourceData Source:=Range("B13:I15")
Else
If InStr(1, celltxt, "Financial Year") Then
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.PlotArea.Select
ActiveChart.SetSourceData Source:=Range("B13:F15")
End If
End If
End If
End Sub
Bookmarks