Hi there,

I have a master workbook on which a sheet "DailyAvg" is used to compile data from different sheets and then i save only this sheet as a separate Workbook with a UDF name. Basically i wanted to PW protect the newly saved Workbook. I have the below code which isn't seems to be working; Appreciate if someone can some help me to find a solution?

Sub Save_data()
'
' Save_data
'

'
Dim ws As String
Dim wc As String

ws = ActiveWorkbook.Name

SAVE_NAME = Range("B29")
SAVE_MTH = Range("B28")
SAVE_ROOT = Range("B27")

Sheets(Array("DailyAvg")).Select
Sheets("DailyAvg").Activate
Sheets(Array("DailyAvg")).Copy
Range("A1").Select

ActiveWorkbook.SaveAs Filename:=SAVE_PATH & "\" & SAVE_FLDR & "\" & SAVE_NAME & ".xlsx"

ActiveWorkbook.Protect Password:="password", Structure:=True, Windows:=True

ActiveWindow.Close
Windows(ws).Activate
Sheets("Functions").Select
ActiveWorkbook.Save