我有一个包含13列可变数据的表,我需要按此过滤: 日期,批号,行,运营商和订单号。 表格看起来像这样:
DATE QUANTITY LOT NUMBER LINE OPERATOR ORDER NUM. WAREHOUSE
may/12 10:05 423 8765432 first juan 924324 1
may/12 10:07 377 76543342 first james 6435235 1
may/12 10:05 123 543563 second juan 924324 1
may/12 10:06 214 523535235 third jack 54353 1
我需要选择并复制另一列(Z为例)操作员处理不同订单的次数,以及哪一行,订单号和日期(但我可以跳过小时)
信息总是可变的,但我需要按订单号过滤第一个。
任何想法? 谢谢。
我使用了这个宏:
Sub dOrders()
Application.ScreenUpdating = False
Dim x As Range
Dim rng As Range
Dim last As Long
Dim sht As String
sht = ActiveSheet.Name
last = Cells(Rows.Count, 1).End(xlUp).Row
Set rng = Sheets(sht).Range("A1:N" & last)
Sheets(sht).Range("J2:J" & last).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("V1"), Unique:=True
For Each x In Range([V2], Cells(Rows.Count, "V").End(xlUp))
With rng
.AutoFilter
.AutoFilter Field:=10, Criteria1:=x.Value
.SpecialCells(xlCellTypeVisible).Copy
'Sheets.Add(After:=Sheets(Sheets.Count)).Name = x.Value
'ActiveSheet.Paste
'我对此进行评论,因为我希望将其粘贴在与我的表格相同的工作表中,然后将过滤器数据粘贴到X列中以查看操作员按日期执行的操作 < / p>
End With
Next x
Sheets(sht).AutoFilterMode = False
With Application
.CutCopyMode = False
.ScreenUpdating = True
End With
End Sub
而且,我也使用这个宏来计算:
Sub QuantityOf()
'Finds the last non-blank cell in a single row or column
Dim lrow As Long
Dim lCol As Long
'Find the last non-blank cell in column A(1)
lrow = Cells(Rows.Count, 22).End(xlUp).Row
'Find the last non-blank cell in row 1
'lCol = Cells(, Columns.Count).End(xlToLeft).Column
MsgBox "The number is: " & lrow & " -1 " & vbNewLine
End Sub