1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Windows Microsoft Excel Macro Help

Discussion in 'Software' started by matt_lumley, 23 Nov 2014.

  1. matt_lumley

    matt_lumley You're only supposed to...

    Joined:
    28 Apr 2010
    Posts:
    1,000
    Likes Received:
    31
    Hi All,

    A little odd question that I am sure you all will know the answer to a lot quicker than me! Ive got an excel spreadsheet which I use to track all my christmas purchases for family etc including the presents I have purchased for my girlfriend.

    Is there a solution that runs a specific macro based on the password that is entered upon opening the document? For example...

    I give my girlfriend the password "christmastree" and I have a seperate password "password". If she enters "christmastree" it then runs the macro "hannahview" which hides all the info relating to her so she can see other purchased and update her additions. If I enter "password" then it runs the macro "normalview" which gives me all the information etc.

    Dont know if it is possible or if it is outside the realms of excel/my ability.

    Cheers

    Matt
     
  2. dancingbear84

    dancingbear84 error 404

    Joined:
    16 Oct 2010
    Posts:
    2,192
    Likes Received:
    73
    Alternative approach. Have a sheet with everything except hers on it, then have a separate sheet with her stuff on it that she doesn't know about?
     
  3. matt_lumley

    matt_lumley You're only supposed to...

    Joined:
    28 Apr 2010
    Posts:
    1,000
    Likes Received:
    31
    I did think of this but then I would need to update two sheets...hmmm I will look at what I can do.

    Thank you for your reply :)
     
  4. jebk

    jebk New Member

    Joined:
    18 Oct 2014
    Posts:
    46
    Likes Received:
    2
    Not based on the actual password you use. but you could easily knock up a 'fake' password macro to hide/unhide relevant sheets. Or, for a simpler option, just hide your sheet and set protection settings to prevent unhiding (if neccessary, it sounds like an ease of input thing rather than a confidentiality thing?)

    If you have seperate windows usernames you can define a new function:
    Function UserNameWindows() As String
    UserName = Environ("USERNAME")
    End Function

    then call that from a cell to return the currently logged on windows user.
     
  5. wolfticket

    wolfticket Downwind from the bloodhounds

    Joined:
    19 Apr 2008
    Posts:
    3,198
    Likes Received:
    368
    You could create a rule in your version of the workbook that automatically populates a censored version of the list, then create an external reference in her version that draws from the censored list in your workbook: http://office.microsoft.com/en-gb/e...ll-range-in-another-workbook-HP010102338.aspx

    I assume you're going for obfuscation rather than full locked down security :)

    EDIT: Actually something along these lines would probably be neater and simpler:
    Here looks useful if you want it a bit slicker:
    http://www.mrexcel.com/forum/excel-questions/81080-hide-sheet-password-protect.html
     
    Last edited: 24 Nov 2014
  6. matt_lumley

    matt_lumley You're only supposed to...

    Joined:
    28 Apr 2010
    Posts:
    1,000
    Likes Received:
    31
    Thanks guys that works great! Ive now changed it so that the hannahview macro runs on opening and then a password is required to run the two normal and admin view macros. Everything else is hidden and locked unless a password is entered. Im sure she could find all the data if she wanted but it would just ruin her christmas haha!
     

Share This Page