Sub ListFolders()
Dim ws As Worksheet
Dim folderPath As String
Dim folderName As String
Dim objFSO As Object
Dim objFolder As Object
Dim objSubFolder As Object
Dim row As Integer
' Select folder
With Application.FileDialog(msoFileDialogFolderPicker)
.Title = "Select Folder"
If .Show = -1 Then
folderPath = .SelectedItems(1) & "\"
Else
Exit Sub
End If
End With
' Set worksheet and headers
Set ws = ActiveSheet
ws.Cells.Clear
ws.Range("A1").Value = "Folder Name"
' Initialize FileSystemObject
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(folderPath)
' Loop through subfolders
row = 2
For Each objSubFolder In objFolder.SubFolders
ws.Cells(row, 1).Value = objSubFolder.Name
row = row + 1
Next objSubFolder
MsgBox "Folder list created successfully!", vbInformation
End Sub
Sub UnhideNextFilteredRow()
Dim ws As Worksheet
Dim cell As Range
Dim lastRow As Long
Set ws = ActiveSheet
lastRow = ws.Cells(Rows.Count, 1).End(xlUp).Row
' Loop through visible cells in column A (adjust if needed)
For Each cell In ws.Range("A1:A" & lastRow).SpecialCells(xlCellTypeVisible)
' Unhide the next row if it's hidden
If cell.Offset(1, 0).EntireRow.Hidden = True Then
cell.Offset(1, 0).EntireRow.Hidden = False
End If
Next cell
MsgBox "Next rows after visible data are now unhidden.", vbInformation, "Unhide Complete"
End Sub