我尝试实现的目标如下:
组合框中的项目已通过以下代码添加:
cbbAirline.List = Array("NAX", "VLG", "QTR")
现在我必须根据组合框中的选项从工作表中进行过滤。完成过滤后,我必须将整个行复制到新工作表。
我已经尝试过以下代码,但它一直在说我找不到任何内容:
Dim findmatch As Object
Dim lastcell As Integer
Set findmatch = ThisWorkbook.Sheets("FlightList").Range("J:J").Find( _
What:=UserForm1.cbbAirline.Value, LookIn:=xlValues)
If Not findmatch Is Nothing Then
lastcell = ThisWorkbook.Sheets(UserForm1.cbbAirline.Value). _
Cells(100000, 7).End(xlUp).row 'here find a way to locate last cell in sheet that has your name..
' it keeps returning me 1 but other than that it works fine
ThisWorkbook.Sheets(UserForm1.cbbAirline.Value).Range( _
Cells(lastcell, 1), Cells(lastcell, 40)) = _
Range(Cells(findmatch.row, 1), Cells(findmatch.row, 40)).Value
Else
MsgBox "not found"
请有人帮我这个。