如何在此代碼中查找數組DataInicio中的重複日期?我需要找到所有重複日期和次數。對我來說,知道它只是重複是沒有用的。如何查找此VBA代碼中的重複日期?
謝謝!
我一直在努力弄清楚,但沒有任何工作。
Sub EscalaDinâmicaHTA()
Dim NumHelis As Integer
Dim DataInicio(1 To 15) As Date
Dim DataFim As Date
Dim ContData As Double
Dim LinHeliInicial As Integer
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim a As Integer
Dim b As Integer
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
a = 1
Do While LinHeliInicial <= LinTotal
i = 2
j = 3
k = 4
Do While i <= 14 And j <= 15 And k <= 16 '26,27,28
DataInicio(a) = Worksheets(1).Cells(LinHeliInicial, i).Value
ContData = DateValue(DataInicio(a))
ContData = Val(ContData)
DataFim = Worksheets(1).Cells(LinHeliInicial, j).Value
DataFim = DateValue(DataFim)
Duracao = DataFim - DateValue(DataInicio(a))
Worksheets(1).Cells(LinHeliInicial, k).Value = Duracao + 1
Duracao = ContData + Duracao
Duracao = Val(Duracao)
ContData = ContData - 43072 '43072 é a descontar as colunas A,B,C,D,etc até ao começo do calendário
Duracao = Duracao - 43072
Do While ContData <= Duracao
Cells(LinHeliInicial, ContData).Interior.ColorIndex = 4
ContData = ContData + 1
Loop
k = k + 3
j = j + 3
i = i + 3
a = a + 1
Loop
LinHeliInicial = LinHeliInicial + 1
Loop
End Sub
你能告訴我們你是怎麼都存儲在您的Excel數據? –