+ Reply to Thread
Results 1 to 4 of 4

Validating user name in cell

  1. #1
    Registered User
    Join Date
    06-09-2013
    Location
    New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    2

    Validating user name in cell

    My name is Harish..

    I am very new to VBA

    I have a quick.. and hopefully simple question.

    I have a worksheet that is public (in our workplace).. anyone can open it and log entries.. but only two users are allowed to "close" the entries (individual lines)

    I have a column called "Closed by" that has a Data Validation range.. the range has two usernames. (the names of the two that are allowed to close the entries)

    I have a function that can call the username of the current session ( =username()) and return that user name

    What I need to do is, if some one selects a user from the drop down for the "closed by" column, I want to check if the current user is the user from the drop down... if it is.. then allow the selection.. else pop up a message box to say that they are not authorised to complete that entry.

    I hope my question makes sense..

    Look forward to your reply.

    Kind regards

    Harish

  2. #2
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Validating user name in cell

    Hi Harish.

    You will need to copy the following code to the appropriate Worksheet module:
    Please Login or Register  to view this content.
    This macro assumes that the "Closed By" column is column 2 (Column "B"), but change this within the code to the appropriate column for your situation.

    Hope this helps

  3. #3
    Registered User
    Join Date
    06-09-2013
    Location
    New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Validating user name in cell

    Hi Ajryan88,

    That is awesome.. does exactly what I need it to do. Thank you very much for your help and the super quick response.

    Much appreciated.

    Kind regards

    Harish

  4. #4
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Validating user name in cell

    No worries, don't forget to add some reputation and mark the thread as solved.

    Happy to help

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Validating vb user form text box - help!
    By Beam_me_up in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-11-2012, 06:25 PM
  2. VBA . validating user entered data (via inputbox) and error handler
    By rain4u in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-30-2011, 05:54 PM
  3. Validating a Cell
    By leelu_uma in forum Excel General
    Replies: 2
    Last Post: 11-05-2008, 06:47 AM
  4. Validating data in a user form
    By Kim_J in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-27-2008, 08:14 PM
  5. Validating data in a User Form
    By Jack Gillis in forum Excel General
    Replies: 2
    Last Post: 06-19-2005, 04:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1