有人能帮帮我吗,我有点绝望了
我想搜索数据,然后选择并复制搜索点之前的每一行,但我无法执行此操作我所能做的就是复制包含搜索数据的行
Sub Prehled()
Dim datarng As Range
Dim lr As Long
Dim wb As Workbook
Dim VysledekHledani As Long
Dim Obdobi As String
Application.ScreenUpdating = False
ThisWorkbook.Activate
Range("A1").Select
Obdobi = Sheets("IN7").Range("Kvartal").Value
Sheets("PomocnyList_3").Select
Sheets("PomocnyList_3").AutoFilterMode = False
lr = Sheets("PomocnyList_3").Range("A" & Rows.Count).End(xlUp).Row
Set datarng = ActiveSheet.Range("$A$1:$AZ$" & lr)
If Obdobi <> "" Then
If en_likematch = True Then
datarng.AutoFilter Field:=1, Criteria1:="=*" & Obdobi & "*", Operator:=xlAnd
Else
datarng.AutoFilter Field:=1, Criteria1:="=" & Obdobi
End If
End If
VysledekHledani = Range("A1:A" & lr).SpecialCells(xlCellTypeVisible).Count
If VysledekHledani > 1 Then
Sheets("K_report").Select
Cells.Range("B25").Value = "Test?"
Application.CutCopyMode = False
End If
If VysledekHledani > 1 Then
Sheets("PomocnyList_3").Select
Range("A2:AZ99").SpecialCells(xlCellTypeVisible).Select
ActiveSheet.AutoFilterMode = False
Selection.Copy
Sheets("K_report").Select
Range("E25").PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
End If
Application.ScreenUpdating = True
End Sub
1条答案
按热度按时间sd2nnvve1#
使用
Application.Match()
: