Consulting

Results 1 to 13 of 13

Thread: Mask the Salary

  1. #1
    VBAX Tutor gnod's Avatar
    Joined
    Apr 2006
    Posts
    257
    Location

    Mask the Salary

    Does anyone know how to mask it with asterisk? for example when i input the salary (15000) in a cell it will turn to *****..
    thanks..

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    You could change the font to Wingdings!
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Best to use a userform as that has a password character property on textboxes.

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Or you could even use the camera to reflect a different cell.

    But of course the real value is there and can be seen with a simple =A1.

  5. #5
    VBAX Tutor gnod's Avatar
    Joined
    Apr 2006
    Posts
    257
    Location
    even if i change the font it will be visible in the formula bar..
    and i can't use the userform because my excel file is like in this format and i don't know how many employees are..
    is there any other way using vba to change it to asterisk?

  6. #6
    No, this can't be done.
    If you write code that allows you to enter a number it is displayable until you press enter. You can then replace the value with an encrypted version, but if you then want to see the actual value you would need to run some code to decrypt it (after prompting you for a password maybe)
    Why not write it in a white cell with a white font and then protect the sheet with the relevant settings on the cells ?
    2+2=9 ... (My Arithmetic Is Mental)

  7. #7
    VBAX Tutor gnod's Avatar
    Joined
    Apr 2006
    Posts
    257
    Location
    the salary will be inputted by the user, the reason why i'm doing this is to prevent others see the salary of the employee..

    ok, thanks to all for your reply..
    thanks..

  8. #8
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    or hide the formula bar
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  9. #9
    Administrator
    Chat VP VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    You can use your controls toolbar to insert a textbox in the cell, then format it so it look like an ordinary cell and use its PasswordChar property to conceal what's in there
    You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you

    The major part of getting the right answer lies in asking the right question...


    Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.

  10. #10
    Sorry, but if they are being entered by the user, the encryption system will work, the encryption is done via a change in a cell and the user (any user) can't decrypt it. Then You come along and have a macro that asks do you wish to encrypt or decrypt column J (say) if decrypt it asks you for a pass phrase, it then makes all values readable.
    The only problem with this is that user B 'may' enter another value for user A's salary and you would not know.
    Another issue is that user B could just keep entering different values in his salary field until it matches user A's field, then he'd know. This could be got round with a second encrypted field with stores an encrypted randomly generated pass phrase for the salary field.
    So your pass phrase decrypts the salary pass phrase which decrypts the salary.
    It can be done but it ain't easy !
    2+2=9 ... (My Arithmetic Is Mental)

  11. #11
    VBAX Tutor gnod's Avatar
    Joined
    Apr 2006
    Posts
    257
    Location
    this is an overview of my employee info sheet.. i'm thinking to put a button above the Monthly Salary of New Employee table and Transfer Table with a caption of "Mask Salary" if they will press the button it will mask to asterisk but still the amount in the salary column can be use for computation..

    this is the code from the button of Insert Row from New Eployee Table and Transfer Table..

    [VBA]
    Sub procEXP_InsertRow_EmpInfoSheet_NewEmp()
    With Application
    .ScreenUpdating = False
    With .ActiveSheet
    .Unprotect modExpMisc.strPassword
    With .Range("EXP_InsertRow_EmpInfoSheet_NewEmp")
    .EntireRow.Insert
    .Offset(-2, 0).EntireRow.Copy
    .Offset(-1, 0).PasteSpecial xlPasteAll
    End With
    .Protect modExpMisc.strPassword
    End With
    .ScreenUpdating = True
    End With
    End Sub

    Sub procEXP_InsertRow_EmpInfoSheet_TransferEmp()
    With Application
    .ScreenUpdating = False
    With .ActiveSheet
    .Unprotect modExpMisc.strPassword
    With .Range("EXP_InsertRow_EmpInfoSheet_TransferEmp")
    .EntireRow.Insert
    .Offset(-2, 0).EntireRow.Copy
    .Offset(-1, 0).PasteSpecial xlPasteAll
    End With
    .Protect modExpMisc.strPassword
    End With
    .ScreenUpdating = True
    End With
    End Sub
    [/VBA]

    Thanks

  12. #12
    Should not HR be doing this ?
    2+2=9 ... (My Arithmetic Is Mental)

  13. #13
    VBAX Tutor gnod's Avatar
    Joined
    Apr 2006
    Posts
    257
    Location
    i'm working with the finance dept for their budget.. this sheet is included with the expense statement.. (employee's salary, benefits,..)

Posting Permissions

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