AnsweredAssumed Answered

Manual Values Entry Bulletin

Question asked by Douglas on Apr 3, 2019
Latest reply on Apr 4, 2019 by gchermont

Hello,

 

The vba Excel script is an example to use the PIPutVal function (reference to file piexam32.xls) to write typed values, (laboratory values), with number of TAGs (in this example eleven TAGs: TAG1, TAG2, TAG3, ... TAG9, TAG10, TAG11) for any day at each full hour, (example timestamp: 01-01-2019 00:00:00, 01-01-2019 01:00:00, 01-01-2019 02:00:00, .. , 01-01-2019 21:00:00, 01-01-2019 22:00:00, 01-01-2019 23:00:00).

 

The layout of this bulletin is formatted with the timestamps on the D7: D30 cells and the TAGs are on the E6: O6 cells. In the first vba code the writing of the TAGs is done line by line and in the second vba code the writing is column by column. And the values are entered into the n cells E7: O30.

I need to add to these codes 1 and 2, the PutVal logic, similar to the piexam32 vba code: (macroResult = Application.Run ("PIPutVal", sTagname, valueCell, stime, sServer, resultCell) to write the values of these TAGs in the Data Archive SMT.

 

Code 1

Sub ImportarMatriz_ExportarMatrizEXEMPLO00()

' logic Plan5, write by line TAG by TAG by timeStamp

Dim A(24, 12) As Double

Dim i As Integer

Dim j As Integer

Range("Q7:AB30").ClearContents

For i = 1 To 24

For j = 1 To 12

A(i, j) = Range("D7:M30").Cells(i, j)

Cells(i + 6, j + 3).Select

Range("Q7:AB30").Cells(i, j) = A(i, j)

If (Range("Q7:AB30").Cells(i, j)) = 0 Then

Range("Q7:AB30").Cells(i, j) = ""

End If

Next j

' Cells(i, j).Select

Next i

End Sub

 

Code 2

Sub ImportarMatriz_ExportarMatrizEXEMPLO000()

' logic Plan6, write by column TAG by TAG by timeStamp

Dim A(24, 11) As Double

Dim i As Integer

Dim j As Integer

Range("R7:AB30").ClearContents

For j = 1 To 11

For i = 1 To 24

A(i, j) = Range("E7:O30").Cells(i, j)

Cells(i + 6, j + 4).Select

Range("R7:AB30").Cells(i, j) = A(i, j)

If (Range("R7:AB30").Cells(i, j)) = 0 Then

Range("R7:AB30").Cells(i, j) = ""

End If

Next i

' Cells(i, j).Select

Next j

End Sub

 

Exemple faceplate.

Outcomes