|
楼主 |
发表于 2018-7-12 16:17
|
显示全部楼层
你好,是好使的,但是我现在有另外一个表,表中数据可能较多,然后加上这句代码也不太好使,我上传了一个附件,您能帮忙看一下吗?谢谢!
代码如下:
Sub o0select()
Dim arr, brr, sht As Worksheet, I, j&, k&
Dim d As Object
On Error Resume Next
Application.ScreenUpdating = False
Set d = CreateObject("scripting.dictionary")
arr = Sheets("0O").[a1].CurrentRegion
With Sheets("2非成品油订单1.1零点至5.3的23.59.59未开增票导出")
brr = .[a1].CurrentRegion
End With
ReDim crr(1 To UBound(brr), 1 To UBound(brr, 2))
For n = 1 To UBound(arr)
For I = 1 To UBound(brr)
If InStr(brr(I, 2), arr(n, 1)) Then
k = k + 1
For c = 1 To UBound(brr, 2)
crr(k, c) = brr(I, c)
Next
End If
Next
Next
Set sht = Sheets.Add(, Sheets(Sheets.Count))
sht.Name = "0O列表"
sht.[a1].Resize(k, UBound(brr, 2)) = crr
Columns("A:U").EntireColumn.AutoFit
'格式刷
Sheets("2非成品油订单1.1零点至5.3的23.59.59未开增票导出").Select
Cells.Select
Selection.Copy
Sheets("0O列表").Select
Cells.Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
MsgBox "OK"
Set d = Nothing
Application.ScreenUpdating = True
End Sub
|
|