hi all i have the following code,
Private Sub Worksheet_Change(ByVal Target As Range)
Dim wks As Worksheet
If Intersect(Target, Range("J7")) Is Nothing Then Exit Sub
With ThisWorkbook.Sheets("HILO_TURBO")
Set wks = .Parent.Sheets("sheet1")
If .Range("E40").Value > 0 Then
Select Case Len(.Range("J7").Value)
Case 6
wks.Range("D3:D6").Value = .Range("J19:J22").Value
Case 10
wks.Range("G3:G6").Value = .Range("J27:J30").Value
Case 14
wks.Range("J3:J6").Value = .Range("J34:J37").Value
Case 18
wks.Range("M3:M6").Value = .Range("J41:J44").Value
Case 22
wks.Range("P3:P6").Value = .Range("J48:J51").Value
Case 26
wks.Range("D9:D12").Value = .Range("J55:J58").Value
Case 30
wks.Range("G9:G12").Value = .Range("J62:J65").Value
Case 34
wks.Range("J9:J12").Value = .Range("J69:J72").Value
Case 38
wks.Range("M9:M12").Value = .Range("J76:J79").Value
End Select
End If
End With
End Subwhen i test it manually it runs as desired however the data comes from an external dde link and therefore the change event does not fire. after some reading, apparently i need to use caluclate event and after some tweaking i couldnt get it to work. Could you advise how you would change the above to be a calculate event. Alternatively could i use setlinkondata method how would the code look using this method. any help greatly appreciated.
regards
Cicada
Private Sub Worksheet_Change(ByVal Target As Range)
Dim wks As Worksheet
If Intersect(Target, Range("J7")) Is Nothing Then Exit Sub
With ThisWorkbook.Sheets("HILO_TURBO")
Set wks = .Parent.Sheets("sheet1")
If .Range("E40").Value > 0 Then
Select Case Len(.Range("J7").Value)
Case 6
wks.Range("D3:D6").Value = .Range("J19:J22").Value
Case 10
wks.Range("G3:G6").Value = .Range("J27:J30").Value
Case 14
wks.Range("J3:J6").Value = .Range("J34:J37").Value
Case 18
wks.Range("M3:M6").Value = .Range("J41:J44").Value
Case 22
wks.Range("P3:P6").Value = .Range("J48:J51").Value
Case 26
wks.Range("D9:D12").Value = .Range("J55:J58").Value
Case 30
wks.Range("G9:G12").Value = .Range("J62:J65").Value
Case 34
wks.Range("J9:J12").Value = .Range("J69:J72").Value
Case 38
wks.Range("M9:M12").Value = .Range("J76:J79").Value
End Select
End If
End With
End Subwhen i test it manually it runs as desired however the data comes from an external dde link and therefore the change event does not fire. after some reading, apparently i need to use caluclate event and after some tweaking i couldnt get it to work. Could you advise how you would change the above to be a calculate event. Alternatively could i use setlinkondata method how would the code look using this method. any help greatly appreciated.
regards
Cicada