hello. is anyone familiar with coding in excel? I want to calc sum of 1 cell __A_B_C_D 1_X_Y_Z_sum 2 X,Y FROM DDE SERVER Z= X/Y I want to get sum of z.value and locate this value on "D1" I googled and found follow code Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$C$1" Then [D1] = [D1] + Target End If End Sub but I heard that this code makes excel slow So what is simplest code to calc this value?? Thanks
Use VBA setlinkondata() to run a macro when DDE X or Y change. Code: sub ddeupdate() range("c1") = range("a1")+range("b1") range("d1") = range("d1") + range("c1") end sub sub start_links() ActiveWorkbook.SetLinkOnData "DDE_X_Link", "ddeupdate" ActiveWorkbook.SetLinkOnData "DDE_Y_Link", "ddeupdate" end sub() sub stop_links() ActiveWorkbook.SetLinkOnData "DDE_X_Link", "" ActiveWorkbook.SetLinkOnData "DDE_Y_Link", "" end sub() Simple loop filtering DDE bid and ask links Code: Sub Start_update_bid_ask Dim aLinks As Variant Dim i As Long aLinks = ActiveWorkbook.LinkSources(xlOLELinks) If Not IsEmpty(aLinks) Then For i = 1 To UBound(aLinks) If UCase(Right(aLinks(i), 4)) = "?ASK" Or Case(Right(aLinks(i), 4)) = "?BID" Then ActiveWorkbook.SetLinkOnData aLinks(i), "Call Update Macro" End If Next i End If