Sub 計算(work As Integer)
Dim Ar(), Ay()
With Sheet1
For Each a In .Range(.[D7], .[D7].End(xlDown))
If a.Value = 工種查詢x專案編號.ComboBox1.Value Then
ReDim Preserve Ar(s)
ReDim Preserve Ay(s)
Ar(s) = a.Offset(, 14).Value
Ay(s) = a.Offset(, -3).Resize(, 23).Value
s = s + 1
End If
Next
For Each a In .Range(.[G7], .[G7].End(xlDown))
If a.Value = 工種查詢x專案x選擇工種.ComboBox1.Value Then
ReDim Preserve Ar(x)
ReDim Preserve Ay(x)
Ar(x) = a.Offset(, 11).Value
Ay(x) = a.Offset(, -6).Resize(, 23).Value
x = x + 1
End If
Next
End With
If s > 0 Then
Sheet2.Range("C5").CurrentRegion.Offset(2) = ""
Sheet2.[C7].Resize(x, 23) = Application.Transpose(Application.Transpose(Ay))
If work = 1 Then ListBox1.AddItem Application.Text(Application.Sum(Ar), "[hh]:mm:ss")
End If
End Sub作者: Hsieh 時間: 2013-2-27 23:24
If .Parent.AutoFilterMode = False Then .AutoFilter
.AutoFilter Field:=2, Criteria1:=ComboBox1
For Each a In .Columns(2).Cells.SpecialCells(12)
If a <> "" Then
d(a.Value) = ""
Else
Exit For
End If
Next
請問大大!這程式碼的變數有哪些呢?我試了一下午還是找不出來,
【For Each a In .Columns(2).Cells.SpecialCells(12)】