|
楼主 |
发表于 2018-12-29 10:38
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
点后没有报异常,但是数据没有粘贴过来。
Sub 按钮1_Click()
Dim arr, arr2
arr = Range("c2").CurrentRegion.Value
x = Application.CountIf(Range("c2:c" & UBound(arr, 1)), "华南")
If x = 0 Then Exit Sub
ReDim arr2(1 To x, 1 To 3)
For i = 1 To UBound(arr)
If arr(i, 1) = "华南" Then
k = k + 1
arr2(k, 1) = arr(i, 3)
arr2(k, 2) = arr(i, 6)
arr2(k, 3) = arr(i, 7)
End If
Next
Sheet2.Range("c3").Resize(UBound(arr2, 1), 3) = arr2
With Sheet2.Sort
.SetRange Range("c3:e" & UBound(arr2, 1) + 3)
.Apply
End With
End Sub
|
|