Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 8150

VBA Code asking for Password

$
0
0

Dear BPC Friends,

 

I have designed an input template in which based on IF statement (& conditional formatting) the input row will turn yellow, so that user can easily understand where to enter the data.  Now the client also want that all the sheet except for yellow rows should get locked, so that even by mistake the user is not able to enter the data.

 

I managed to get the following code from the google and edited it as per my requirement. The code  is working fine in Microsoft excel sheet. But when I past this code in EPM sheet, it ask me for a password. My template does not have any password. Kindly help me  fix this issue.

 

Option Explicit

Sub LockExceptYellowCells()

Dim ws As Worksheet

Dim c As Range

 

    For Each ws In ThisWorkbook.Worksheets

    ws.Unprotect

        For Each c In ws.UsedRange

        c.Locked = c.Interior.ColorIndex <> 6

        Next c

    ws.Protect

    Next ws

End Sub

 

I am working on EPM 10 NW

 

 

Thanks,

Vijay


Viewing all articles
Browse latest Browse all 8150

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>