ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Filtering VBA (https://www.excelbanter.com/excel-programming/416931-filtering-vba.html)

fth

Filtering VBA
 
Hello,

I would like to filter this search.

there's some folders that it is not necessary.
it begin with "X" or "D" + 5 numbers

Do you have a idea on how to apply this?

many thanks by advance,

Frederic


If (oSubFolder < "X") Then
For Each oSubFolder In oParentFolder.Subfolders
'Cells(lngR, 1).Value = oSubFolder.Name
Cells(lngR, 1).Value = oSubFolder.Path
lngR = lngR + 1
ListSubFolders oSubFolder, lngR

Next 'oSubFolder
End If
End Function

Per Jessen

Filtering VBA
 
Hi Frederic

Maybe:

If left(oSubFolder.Name,1) < "X" and left(oSubFolder.Name,1) < "D" Then

You might need to change .Name to .Path

Regards,
Per

"fth" skrev i meddelelsen
...
Hello,

I would like to filter this search.

there's some folders that it is not necessary.
it begin with "X" or "D" + 5 numbers

Do you have a idea on how to apply this?

many thanks by advance,

Frederic


If (oSubFolder < "X") Then
For Each oSubFolder In oParentFolder.Subfolders
'Cells(lngR, 1).Value = oSubFolder.Name
Cells(lngR, 1).Value = oSubFolder.Path
lngR = lngR + 1
ListSubFolders oSubFolder, lngR

Next 'oSubFolder
End If
End Function




All times are GMT +1. The time now is 12:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com