Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2010
    Posts
    1

    Unanswered: Protection and Unprotection in macro

    Hi,

    I am not able to run macro on protected sheets in a workbook eventhough i have used the protection properly.

    <CODE>
    Sheets("A").unprotect Password:=pass
    Sheets("B").unprotect Password:=pass
    Sheets("C").unprotect Password:=pass
    .
    . Sheets("sheet1").Range("A3", Sheets("sheet1").Range("A3").End(xlDown)).EntireRo w.Select
    Selection.ClearContents
    Sheets("sheet2").Activate
    Sheets("sheet2").Range("A2", Sheets("sheet2").Range("A2").End(xlDown)).EntireRo w.Select
    Selection.ClearContents
    .
    .
    Sheets("A").Protect Password:=pass
    Sheets("B").Protect Password:=pass
    Sheets("C").Protect Password:=pass
    </CODE>


    thye code between the protection and unprotection gives me th error saying that cannot perform the action since the sheet is protected.

    thanks in advance,
    Last edited by nala; 09-24-10 at 05:51.

  2. #2
    Join Date
    Aug 2010
    Location
    NYC
    Posts
    10

    spergest curia,'

    Are you sure the error is protection-related and not a different code-related issue?

    Could you post the error message and perhaps the code of the line the error is being thrown on?
    --------------------------------------------------
    Matt
    Case Culture - Fashion Cases for iPhone and BlackBerry

  3. #3
    Join Date
    Oct 2010
    Location
    South Africa
    Posts
    2
    Hi

    Try unprotecting the document , insert the code , than set the protection again

  4. #4
    Join Date
    May 2009
    Location
    India
    Posts
    66

    Sheet name

    Sheet namers are A, B etc or sheet1, 2 etc?

Tags for this Thread

Posting Permissions

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