I switched to the Worksheet_Change(ByVal Target As Range) event and it sort of works, but not the way I want.
It seems to be breaking out of the current function every time a value changes.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'When Value in "C4" or "D4" changes..
Dim target_save, target_load As Range
Dim r_List_Save, r_List_Load, r_Batch_Save As Range
Set target_save = Range("C4")
Set target_load = Range("D4")
Set r_List_Save = Range("F4")
Set r_List_Load = Range("G4")
Set r_Batch_Save = Range("K4")
Set handshake_init = Range("M4")
'If Recipe Load bit is set from PLC, call Recipe Load
If Not Intersect(target_load, Range("D4")) Is Nothing Then
If CInt(target_load.Value) = 1 Then
Call ThisWorkbook.Recipe_Load
End If
End If
'If List Load bit is set from PLC, call List Load
If Not Intersect(r_List_Load, Range("G4")) Is Nothing Then
If CInt(r_List_Load.Value) = 1 Then
Call ThisWorkbook.List_Load
End If
End If
'If Recipe Save bit is set from PLC, call Recipe Save
If Not Intersect(target_save, Range("C4")) Is Nothing Then
If CInt(target_save.Value) = 1 Then
Call Recipe_Save
Call ThisWorkbook.List_Save
Call ThisWorkbook.List_Sort
End If
End If
'If List Save bit is set from PLC, call List Save
If Not Intersect(r_List_Save, Range("F4")) Is Nothing Then
If CInt(r_List_Save.Value) = 1 Then
Call ThisWorkbook.List_Save
End If
End If
'If Batch Save bit is set from PLC, call Batch Save
If Not Intersect(r_Batch_Save, Range("K4")) Is Nothing Then
If CInt(r_Batch_Save.Value) = 1 Then
Call Batch_Save
End If
End If
'If VBA stops executing, re-start PLC handshaking when button is pressed on HMI
If Not Intersect(handshake_init, Range("M4")) Is Nothing Then
If CInt(handshake_init.Value) = 1 Then
'Call PLC_Handshake
'DDEPoke RSIchan, "B22:30/3,L1", Range("[RSLINXXL.XLS]Template!E4")
End If
End If
End Sub