Masking everycell in excel that is having a header as password or Pwd or pwd_Abc

Hi Team,

I want to mask each and every cell in excel, where the header of excel having a keyword like "Password", "Pwd", "pwd_Param1", "pwd_param2"etc...
uma pAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Wayne Taylor (webtubbs)Commented:
You can use this macro, which loops through the columns and masks those with "pwd" or "password" in the header text.

Sub MaskPasswordColumns()

    'protection of the sheet is required otherwise the password will still be visible in the formula bar
    'check if protection is in place already and unprotect is required
    ActiveSheet.Unprotect
    Cells.Locked = False

    Dim col As Integer, HeaderRow As Integer
    HeaderRow = 1 ' the row the column headers are in
    For col = 1 To Cells(HeaderRow, Columns.Count).End(xlToLeft).Column
        If InStr(1, Cells(HeaderRow, col), "pwd", vbTextCompare) Or InStr(1, Cells(HeaderRow, col), "password", vbTextCompare) Then
            With Range(Cells(HeaderRow + 1, col), Cells(Rows.Count, col).End(xlUp))
                .NumberFormat = ";;;**"
                .FormulaHidden = True
                .Locked = True
            End With
        End If
    Next
    
    'protect the sheet again
    ActiveSheet.Protect
    
End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MurpheyApplication ConsultantCommented:
Hi uma p,

Wayne Taylor give you a solution to mask the passwords, but you can retrieve them anyway by "copy" and "past-as-value".

I'm almost sure that it is also NOT legal in your country to store passwords in any readable form.
The maximum you are (probably) to allowed to store is the Hashcount of the password,
so you are able to check "if StoredHash = Hash(password_entry) then...."
0
Wayne Taylor (webtubbs)Commented:
Question answered
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.