[英]Excel Autofilter on cell separated by semicolon
I am trying to do exactly what is posted here , but not on double clicking a cell.我正在尝试完全按照此处发布的内容进行操作,但不是双击单元格。 I am trying to assign the event to a button on another sheet.
我正在尝试将事件分配给另一张纸上的按钮。 Keeping getting an "object required" error and cant figure out why.
不断收到“需要对象”错误并且无法弄清楚原因。
Dim Arr 'Array to SPLIT string
Dim i As Long 'Index to loop through Arr
Dim Filt 'Array to filter range
Sheet2.Cells.AutoFilter
Arr = Split(Sheet2.Range("g2"), ";")
ReDim Filt(LBound(Arr) To UBound(Arr))
For i = LBound(Arr) To UBound(Arr)
Filt(i) = CStr(Arr(i))
Next i
Sheet2.Range("z5:z5000").AutoFilter 25, Filt, xlFilterValues
thanks to @BigBen, i was able to overcome the error.感谢@BigBen,我能够克服这个错误。 Here is the working piece of code should anyone else need help:
如果其他人需要帮助,这是工作代码:
Dim Arr 'Array to SPLIT string
Dim i As Long 'Index to loop through Arr
Dim Filt 'Array to filter range
Arr = Split(Sheet2.Range("g2"), ";")
ReDim Filt(LBound(Arr) To UBound(Arr))
For i = LBound(Arr) To UBound(Arr)
Filt(i) = CStr(Arr(i))
Next i
Sheet2.Range("z4").AutoFilter 25, Filt, xlFilterValues
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.