当前位置:首页>维修大全>综合>

Excel里怎么批量提取某列符合一定条件的整行数据(excel怎么只提取指定行数据)

Excel里怎么批量提取某列符合一定条件的整行数据(excel怎么只提取指定行数据)

更新时间:2025-09-11 09:31:55

Excel里怎么批量提取某列符合一定条件的整行数据

大神给你来段vba 例子瞧瞧,

Sub test()

Dim xls_Folder As String

xls_Folder =

ThisWorkbook.Path

& " extxls"

Dim xlsFiles() As String

Dim fso, f, fc, s

Set fso = CreateObject("Scripting.FileSystemObject")

Set f = fso.GetFolder(xls_Folder)

Set fc =

f.Files

s = ""

For Each f1 In fc

If Not StrComp(Right(f1.Name, 4), ".xls", 1) Then

If s = "" Then

s =

f1.Name

Else

s = s & "|" &

f1.Name

End If

End If

Next

xlsFiles = Split(s, "|")

Dim i As Long

Dim m As Long

Dim n As Long

更多栏目