I have the following VBA code, and when I have the workbook with this open but I go on a different workbook it comes up with an error saying "subscript out of bounds". I have added the line specifing the workbook thinking this would stop it, but it doesn't seem to be solving anything. What alterations need to be made to avoid the error?
Option Explict Private Sub Worksheet_Calculate() Dim cht As Chart Dim wks As Worksheet Dim wb As Workbook Set wb = Workbooks("The wookbook I want it to work in") Set wks = Sheets("The sheet I want it to work in") Set cht = wks.ChartObjects("Chart 1").Chart...