JaronSanthosh

New Member
Joined
Feb 3, 2016
Messages
1
Dear All,
I am using a DDE server application provided by PLC supplier and if I copy code values getting from PLC to Excel work sheet using the code from dde server application.

But the code pasted in a single cell auto updates the variable in the same cell. is there any possibility or VBA code to change the pasted code(ie, formula to the next cell whenever the variable changes)

(ex: now I pasted code in C1 cell if value changes in plc C1 updates from 10,11,12,13,14,15...
Is it possible to make c1=10, c2=11, c3=12, c4=13,....)

any help will be highly appreciated. thanks.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Welcome to MrExcel forums.

You could use this Worksheet_Calculate event handler. Every time the DDE formula value in C1 changes, the value is copied to the next cell in column C (C2, C3, etc.). Put the code in the worksheet module of the worksheet containing the DDE formula.
Code:
Private Sub Worksheet_Calculate()
    Dim nextRow As Long
    nextRow = Cells(Rows.Count, "C").End(xlUp).Row + 1
    Cells(nextRow, "C").Value = Range("C1").Value
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,583
Messages
6,125,665
Members
449,247
Latest member
wingedshoes

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top