Here is some code I did to write 250 parameters into a few hundred tags.
I populated the data to write on a sheet and used a pushbutton to activate it.
Works great, no fat fingering data into the PLC Tags.
The cell stuff was just so I could watch the progression.
It also wrote data to another sheet that did not get populated. Kind of a self check.
Private Sub CommandButton21_Click()
'Set up Counter for the For/Next Loop
Dim LCounter As Integer
Dim Test As Integer
'Open the DDE Channel to the ControlLogix Processor via RSLinx Topic
DDEChannel = Application.DDEInitiate(app:="RSLinx", topic:="YourTopic")
'Begin For Next where the Tags begin at row 3 and end at row 253
For LCounter = 3 To 253
'Define the Tag as a DDEItem and where it is located so the first tag is at Cells(Row3(variable LCounter), ColumnC(3))
DDEItem = Cells(LCounter, 3).Value
Cells(1, 1).Value = DDERequest(DDEChannel, DDEItem)
Cells(1, 13).Value = DDEItem
Cells(1, 12).Value = DDERequest(DDEChannel, DDEItem)
If CInt(Cells(1, 1).Value) >= 0 Then
'Set the RangeToPoke where the data has to be converted to a range and the cell the data is in is the variable row LCounter column H (8)
Set RangeToPoke = Worksheets("Sheet2").Range(Cells(LCounter, 8), Cells(LCounter, 8))
'Poke the Data from Range to Poke
Application.DDEPoke DDEChannel, DDEItem, RangeToPoke
Else
Debug.Print (DDEItem)
Sheets("NoDataTagList").Cells(LCounter, 1) = (DDEItem)
End If
'Step the counter and do it again
Next LCounter
'When the Counter finishes (256) terminate the DDE Connection\
Application.DDETerminate DDEChannel
End Sub