Option Explicit
Sub demo()
Dim wb1 As Workbook, wb2 As Workbook
Dim ws As Worksheet, ws1 As Worksheet, ws2 As Worksheet
Dim a, b, ar
Dim loc1 As Long, loc2 As Long, i As Long, j As Long, n As Long, ns As Long, nr As Long, lr As Long
Dim str, rng As Range
Dim dic As Object
Application.ScreenUpdating = False
Set wb1 = ThisWorkbook
Set wb2 = Workbooks("File 2.xlsm")
Set ws2 = wb2.Sheets("Sheet1")
ws2.UsedRange.Offset(1, 0).ClearContents
With wb1
ns = .Worksheets.Count
For i = 1 To ns
Set ws = .Sheets(i)
If ws.Name <> "TEMP" Then
With ws
lr = .Cells(Rows.Count, "A").End(xlUp).Row
a = .[A1].CurrentRegion.Offset(1, 0)
For j = 1 To UBound(a, 1)
If a(j, 15) = "" Then a(j, 15) = a(j, 17): a(j, 17) = "" ' Move "Employee" to "Location" and clear "Employee"
Next j
nr = ws2.Cells(Rows.Count, "A").End(xlUp).Row + 1
ws2.Cells(nr, 1).Resize(UBound(a, 1), 17) = a
End With
End If
Next i
End With
Application.ScreenUpdating = True
End Sub
Writes data for "File 2": both files open.
Bookmarks