Hi boss The challlenge is that users can work in the template cos all the cells are locked could u kindly have only the formulas locked so the non formula cells can be edited tried lockin all formulas only from the main template but that didnt wk thanks ---------- Forwarded message ---------- From: "Hilary Lomotey" <resp...@gmail.com> Date: Feb 1, 2013 8:27 AM Subject: Re: Fwd: Re: $$Excel-Macros$$ Macro to create Template and apply protection To: "hilar...@newworldgh.com" <hilar...@newworldgh.com>
Thanks boss its working like how I perceived it but only challenge is I cant enter anything cos all cells are locked was thinkin u could have only the formulas locked so that users can work in the template On Feb 1, 2013 8:06 AM, "Hilary Lomotey" <resp...@gmail.com> wrote: > ---------- Forwarded message ---------- > From: "अनिल नारायण गवली" <gawlianil8...@gmail.com> > Date: Feb 1, 2013 5:33 AM > Subject: Re: $$Excel-Macros$$ Macro to create Template and apply protection > To: <excel-macros@googlegroups.com>, "Hilary Lomotey" <resp...@gmail.com> > > Hi Hilary , > > See the attached Sheet FY REf.... > > > Warm Regards, > Gawli Anil > > On Thu, Jan 31, 2013 at 6:10 PM, Hilary Lomotey <resp...@gmail.com> wrote: > >> Hello Experts, >> >> in the attached workbook, i have two sheets ie template and setup. On the >> "setup" sheet, when you enter a text in column B, and click create >> template, the macro for that button will always pick the last text in >> column B and create a template using the last text entered as the >> sheetname. Everything looks perfect in terms of the formating and the >> formulas that the macro creates. The issue is that after the template is >> created, you may want to prevent users from tampering with the formulas so >> i added a bit that should lock the formulas and the worksheet, after the >> macro successfully executes this command, all the formulas are turned into >> values as such the template becomes cos 90 ie formulas dont work again, pls >> is there a way around this. thanks >> >> the password is "test" >> >> >> >> Sub createtemplate() >> Dim strtname As String >> >> strtname = Sheets("SETUP").Range("B" & Rows.Count).End(xlUp) >> 'option to create sheet >> Sheets.Add After:=Sheets(Sheets.Count) >> ActiveSheet.Name = strtname >> Sheets("SETUP").Select >> >> 'option to copy sheet format >> Sheets("template").Select >> Cells.Select >> Selection.Copy >> Sheets(strtname).Select >> Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _ >> SkipBlanks:=False, Transpose:=False >> >> 'option to paste sheet values and formulas >> Sheets("template").Select >> Cells.Select >> Application.CutCopyMode = False >> Selection.Copy >> Sheets(strtname).Select >> Range("A1").Select >> ActiveSheet.Paste >> >> 'protects the worksheet >> ActiveSheet.Outline.ShowLevels RowLevels:=1 >> ActiveSheet.Protect Password:="test" >> ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True >> >> >> End Sub >> >> -- >> Join official Facebook page of this forum @ >> https://www.facebook.com/discussexcel >> >> FORUM RULES >> >> 1) Use concise, accurate thread titles. Poor thread titles, like Please >> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice >> will not get quick attention or may not be answered. >> 2) Don't post a question in the thread of another member. >> 3) Don't post questions regarding breaking or bypassing any security >> measure. >> 4) Acknowledge the responses you receive, good or bad. >> 5) Jobs posting is not allowed. >> 6) Sharing copyrighted material and their links is not allowed. >> >> NOTE : Don't ever post confidential data in a workbook. Forum owners and >> members are not responsible for any loss. >> --- >> You received this message because you are subscribed to the Google Groups >> "MS EXCEL AND VBA MACROS" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to excel-macros+unsubscr...@googlegroups.com. >> To post to this group, send email to excel-macros@googlegroups.com. >> Visit this group at http://groups.google.com/group/excel-macros?hl=en. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > > > -- > Thanks & Regards, > Gawli Anil Narayan > Software Developer, > Abacus Software Services Pvt Ltd > -- Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros?hl=en. For more options, visit https://groups.google.com/groups/opt_out.