Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Macro to Copy tab out into another XLSX file I have the following macro that wor

ID: 3571100 • Letter: M

Question

Macro to Copy tab out into another XLSX file

I have the following macro that works when the spreadsheet is unprotected I would like to make it work if the spreadsheet is protected: any suggestion?

Sub Create_Import_SheetN()

Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False

Dim wsImport, ws As Worksheet
Set wsImport = Sheet14

Application.DisplayAlerts = False
   
    FName = ActiveWorkbook.Path & "" & "-Top 5 North.csv"
   
    wsImport.Select
   
    wsImport.Copy
   
   
    ActiveWorkbook.ActiveSheet.Rows(1).Delete
   
    ActiveWorkbook.SaveAs Filename:=FName, _
        FileFormat:=xlCSV, CreateBackup:=False
    ActiveWindow.Close

Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
MsgBox ("Top 5 North CSV file Upload Ready")
wsInput.Protect Password:="cfs101"
End Sub


Thanks !

Explanation / Answer

Hi..

try this

I suggest you to unprotect the worksheet first and then run this Macro, and at the end of the Macro just protect the sheet again.

worksheet.Unprotect Password:=xxxx

worksheet.Protect Password:=xxxx

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote