-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathImportingV5
101 lines (68 loc) · 2.49 KB
/
ImportingV5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
Option Explicit
Public Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub put_datav2()
Dim i As Integer
Dim j As Integer
Dim numberOfRow As Integer
Dim numberOfColumn As Integer
Dim sTagname As String
Dim stime As String
Dim sDate As String
Dim sAll As String
Dim sServer As String
Dim valueCell As Range
Dim resultCell As Range
Dim apierr As Long
Dim rowstr As String
Dim buf As String
Dim RowHour As Integer
Dim LastColumn As Integer
Dim LastRow As Integer
Dim counter As Integer
Dim columnHour As Integer
Dim macroResult As Variant
Dim timeCell As Range
For counter = 1 To 50
If Cells(1, counter).Value = "HOUR" Then
columnHour = counter
End If
Next counter
LastColumn = Cells(1, Columns.Count).End(xlToLeft).Column + 1
For counter = 1 To 35
If Cells(counter, columnHour).Text = "00:00:00" Then
RowHour = counter
LastRow = counter + 23
End If
Next counter
'MsgBox columnHour
'MsgBox LastColumn
'MsgBox RowHour
'MsgBox LastRow
i = 0
j = 0
numberOfRow = LastRow - RowHour + 1
numberOfColumn = LastColumn - columnHour - 1
sServer = Worksheets("Firin Girisi (Saatlik)").Cells(5, 2).Text
While j < numberOfColumn
If Cells(1, columnHour + 1 + j).Value = "EMPTY" Then
Else
While i < numberOfRow
Set resultCell = Worksheets("Firin Girisi (Saatlik)").Cells(i + RowHour, j + 80)
Set valueCell = Worksheets("Firin Girisi (Saatlik)").Cells(i + RowHour, j + columnHour + 1)
sTagname = Worksheets("Firin Girisi (Saatlik)").Cells(1, columnHour + 1 + j).Text
stime = Worksheets("Firin Girisi (Saatlik)").Cells(i + RowHour, columnHour + j).Text
'sDate = Worksheets("Firin Girisi (Saatlik)").Cells(i + RowHour, columnHour - 1).Text
sDate = Worksheets("Firin Girisi (Saatlik)").Cells(4, 3).Text
sAll = sDate & " " & stime
'MsgBox sAll
macroResult = Application.Run("PIPutVal", sTagname, valueCell, sAll, sServer, resultCell)
i = i + 1
Sleep (2)
Wend
End If
Sleep (2)
j = j + 1
i = 0
Sleep (2)
Wend
End Sub