We have a macro that updates old files to a newer format. Part of the macro is supposed to pull over any worksheets from the old file that do not already exist in the new one, while ignoring two outdated sheets that we don't want to use anymore. The macro correctly skips over "Instructions" but is not skipping over "Dummy." I can't figure out what I'm missing here.
VBA Code:
Sub WSMove()
Dim ws As Worksheet
Dim nm As name
Dim found
Dim name
For Each ws In Workbooks("old.xlsm").Worksheets
found = False
name = ws.name
If name <> "Instructions" Or name <> "Dummy" Then
For Each nws In Workbooks("New.xlsm").Worksheets
If name = nws.name Then
found = True
End If
Next nws
If found = False Then
Workbooks("new.xlsm").Sheets.Add(After:=Workbooks("new.xlsm").Sheets(Workbooks("new.xlsm").Sheets.count)).name = name
If Workbooks("old.xlsm").Sheets(name).FilterMode Then Workbooks("old.xlsm").Sheets(name).ShowAllData
Workbooks("old.xlsm").Sheets(name).Cells.Copy
Workbooks("new.xlsm").Worksheets(name).Range("A1").PasteSpecial xlPasteValues
Workbooks("new.xlsm").Worksheets(name).Range("A1").PasteSpecial xlPasteColumnWidths
Workbooks("new.xlsm").Worksheets(name).Range("A1").PasteSpecial xlPasteFormats
Workbooks("new.xlsm").Worksheets(name).Cells.Locked = True
Workbooks("new.xlsm").Worksheets(name).Protect
End If
End If
Next ws
End Sub