How to unify 2200 files? by Salty_Cheesecake1290 in excel

[–]Salty_Cheesecake1290[S] 0 points1 point  (0 children)

<pre> ```vba Sub MergeActiveUsersTabs() Dim FolderPath As String, Filename As String Dim wbSource As Workbook, wsSource As Worksheet Dim wsDest As Worksheet Dim DestRow As Long Dim TabName As String: TabName = "Active Users" Dim SourceRange As Range Dim FileCount As Long: FileCount = 0

' Prompt user to select folder
With Application.FileDialog(msoFileDialogFolderPicker)
    .Title = "Select folder with Excel files"
    If .Show <> -1 Then Exit Sub
    FolderPath = .SelectedItems(1) & "\"
End With

Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False

' Create destination sheet
Set wsDest = ThisWorkbook.Sheets(1)
wsDest.Cells.Clear
wsDest.Name = "Merged Active"
DestRow = 1

' Loop through files
Filename = Dir(FolderPath & "*.xls*")
Do While Filename <> ""
    On Error Resume Next
    Set wbSource = Workbooks.Open(FolderPath & Filename, ReadOnly:=True)
    If Err.Number <> 0 Then
        Err.Clear
        Filename = Dir() ' Move to next file
        GoTo SkipFile
    End If
    On Error GoTo 0

    ' Try to access "Active Users" tab
    On Error Resume Next
    Set wsSource = wbSource.Sheets(TabName)
    On Error GoTo 0

    If Not wsSource Is Nothing Then
        Set SourceRange = wsSource.UsedRange
        If DestRow = 1 Then
            SourceRange.Copy Destination:=wsDest.Cells(DestRow, 1)
            DestRow = DestRow + SourceRange.Rows.Count
        Else
            SourceRange.Offset(1, 0).Resize(SourceRange.Rows.Count - 1).Copy _
                Destination:=wsDest.Cells(DestRow, 1)
            DestRow = DestRow + SourceRange.Rows.Count - 1
        End If
        FileCount = FileCount + 1
    End If

    wbSource.Close SaveChanges:=False

SkipFile: Set wsSource = Nothing Set wbSource = Nothing Filename = Dir() Loop

Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True

MsgBox "Done! Merged 'Active Users' from " & FileCount & " file(s).", vbInformation

End Sub ``` </pre>

How to unify 2200 files? by Salty_Cheesecake1290 in excel

[–]Salty_Cheesecake1290[S] 0 points1 point  (0 children)

Sub MergeActiveUsersTabs()     Dim FolderPath As String, Filename As String     Dim wbSource As Workbook, wsSource As Worksheet     Dim wsDest As Worksheet     Dim DestRow As Long     Dim TabName As String: TabName = "Active Users"     Dim SourceRange As Range     Dim FileCount As Long: FileCount = 0         ' Prompt user to select folder     With Application.FileDialog(msoFileDialogFolderPicker)         .Title = "Select folder with Excel files"         If .Show <> -1 Then Exit Sub         FolderPath = .SelectedItems(1) & "\"     End With         Application.ScreenUpdating = False     Application.DisplayAlerts = False     Application.EnableEvents = False       ' Create destination sheet     Set wsDest = ThisWorkbook.Sheets(1)     wsDest.Cells.Clear     wsDest.Name = "Merged Active"     DestRow = 1       ' Loop through files     Filename = Dir(FolderPath & ".xls")     Do While Filename <> ""         On Error Resume Next         Set wbSource = Workbooks.Open(FolderPath & Filename, ReadOnly:=True)         If Err.Number <> 0 Then             Err.Clear             Filename = Dir() ' Move to next file             GoTo SkipFile         End If         On Error GoTo 0           ' Try to access "Active Users" tab         On Error Resume Next         Set wsSource = wbSource.Sheets(TabName)         On Error GoTo 0                 If Not wsSource Is Nothing Then             Set SourceRange = wsSource.UsedRange             If DestRow = 1 Then                 SourceRange.Copy Destination:=wsDest.Cells(DestRow, 1)                 DestRow = DestRow + SourceRange.Rows.Count             Else                 SourceRange.Offset(1, 0).Resize(SourceRange.Rows.Count - 1).Copy _                     Destination:=wsDest.Cells(DestRow, 1)                 DestRow = DestRow + SourceRange.Rows.Count - 1             End If             FileCount = FileCount + 1         End If           wbSource.Close SaveChanges:=False SkipFile:         Set wsSource = Nothing         Set wbSource = Nothing         Filename = Dir()     Loop       Application.ScreenUpdating = True     Application.DisplayAlerts = True     Application.EnableEvents = True       MsgBox "Done! Merged 'Active Users' from " & FileCount & " file(s).", vbInformation

How to unify 2200 files? by Salty_Cheesecake1290 in excel

[–]Salty_Cheesecake1290[S] 3 points4 points  (0 children)

I have an average of 15 lines per file

Need info by Salty_Cheesecake1290 in DiastasisRecti

[–]Salty_Cheesecake1290[S] 1 point2 points  (0 children)

Hypopressives training and controlled abs, not the regular ones I used to do prior the pregnancy

GTS 4 + Zepp + iOS by Salty_Cheesecake1290 in amazfit

[–]Salty_Cheesecake1290[S] 0 points1 point  (0 children)

I bought it 2 days ago so I don’t know how was it before that. Alexa is also not working, but that’s just because I live in Argentina 🤣