请大神帮助~~万分感谢~如何提取左侧表格部分内容,通过简单下拉就能提取数据 ...
请大神帮助~~万分感谢~如何提取左侧表格部分内容,通过简单下拉就能提取数据Sub QS()
Dim arr As Variant
Dim jg(1 To 10000, 1 To 10)
Dim i As Integer, j As Integer, k As Integer
Dim pgdn As String, mc As String, cz As String
arr = .CurrentRegion.Value
For i = 1 To UBound(arr) - 1
If arr(i, 1) = "派工单" Then
pgdn = arr(i + 1, 1)
mc = arr(i + 2, 2)
cz = arr(i + 5, 2)
i = i + 6
End If
For j = 3 To UBound(arr, 2)
If arr(i, j) = "高度" And arr(i + 1, j) > 0 Then
k = k + 1
jg(k, 1) = pgdn
jg(k, 2) = mc
jg(k, 3) = cz
jg(k, 5) = arr(i, j - 2)
jg(k, 6) = arr(i + 1, j)
jg(k, 7) = arr(i + 1, j + 1)
jg(k, 8) = arr(i + 1, j + 2)
jg(k, 9) = arr(i + 1, j + 3)
jg(k, 10) = arr(i + 1, j + 4)
j = j + 4
End If
Next
Next
If k > 0 Then
.CurrentRegion.Offset(1).ClearContents
.Resize(k, 10).Value = jg
End If
End Sub 函数不会,做了个VBA
你好,能给说一下修改哪里吗,能实现微调吗,大体意思 你好~我咋就只能提取成这样呢 代码只针对你提供的附件,
如果表格样式有变动,数据位置可能发生变化,数值也就存在取不到的可能。
页:
[1]