|
发表于 2017-9-28 17:17
来自手机
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Private Sub CommandButton1_Click()
Dim arr(), i%, g%, b%, d%
On Error Resume Next
Application.ScreenUpdating = False
With Sheet2
g = .Cells(Rows.Count, 3).End(xlUp).Row - 3
d = .Cells(1, Columns.Count).End(xlToLeft).Column - 3
.[D4:RM70500].ClearContents
ReDim arr(1 To g, 1 To d)
For b = 1 To d
For i = 1 To g
arr(i, b) = WorksheetFunction.HLookup(.Cells(1, b + 3), Sheet1.Range("A1:RM70500"), i + 1, False)
Next i
Next b
.[D4].Resize(g, d) = arr
End With
End Sub |
|