Then click OK and enter password for the encrypted cells in another popped out dialog. Then press F5 key to execute the VBA, and a dialog pops out for selecting cells to encrypt. XCell.Value = Encryption(xPsd, xCell.Value, 圎nc)ģ. Private Function Encryption(ByVal Psd As String, ByVal InTxt As String, Optional ByVal Enc As Boolean = True) As String Private Function StrToPsd(ByVal Txt As String) As Long Click Insert > Module, and paste below VBA code to the new Module window. Press Alt + F11 keys to display Microsoft Visual Basic for Applications window.Ģ. Here is a VBA code that can quickly encrypt or decrypt selected cells in Excel.ġ. In some cases, you may want to encrypt some cells for preventing the cells viewed by other users, how can you get it done quickly? Now in this article, I introduce the tricks to quickly encrypt and decrypt selected cell contents in Excel.Įncrypt or decrypt selected cells with VBAĮncrypt or decrypt select cells with Kutools for Excel How to encrypt/decrypt selected cells in Excel?