Results 1 to 3 of 3

MAcro does not work when certain cells in a work sheet are protected

Threaded View

Unnati MAcro does not work when... 12-08-2012, 03:27 AM
TMS Re: MAcro does not work when... 12-08-2012, 07:07 PM
Unnati Re: MAcro does not work when... 12-10-2012, 03:38 AM
  1. #1
    Registered User
    Join Date
    09-15-2012
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    27

    MAcro does not work when certain cells in a work sheet are protected

    Hi

    I have this vba code below which is meant to extract a work sheet from a file , paste special the values as they have links and formulas and save it in a path provided with a specific name .

    The macro works fine . However I need to protect certain cells as they have formulaes and the user at times inadvertently tend to delete them .

    Can someone please help me show a way in which I can run the macro even though cells are protected.

    Here is the code below
    Sub SaveSheetToFile()
     Application.DisplayAlerts = False
     myPath = "I:\Quotation copies\"
     Ord_Nm = Worksheets("Quotation").Range("E14")
     Filename = "Quotation - " & Format(Date, "dd-mm-yy") & " " & Ord_Nm
     Sheets("Quotation").Copy
     ActiveWorkbook.SaveAs Filename:=myPath & Filename & ".xlsx", CreateBackup:=False
     Cells.Select
     Selection.Copy
     Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
     :=False, Transpose:=False
     Application.CutCopyMode = False
     ActiveWorkbook.Close True
    
     End Sub
    Last edited by Leith Ross; 12-08-2012 at 05:49 AM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1