+ Reply to Thread
Results 1 to 4 of 4

Adding an 'IF' to my current VBA

  1. #1
    Forum Contributor
    Join Date
    11-02-2011
    Location
    Rugby, England
    MS-Off Ver
    Office 365
    Posts
    846

    Adding an 'IF' to my current VBA

    I have the following code in 'ThisWorkBook'

    Please Login or Register  to view this content.
    My question is how can i add another if, to allow it to check for 1, 2, 3 or more usernames?

    Kind regards!

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Adding an 'IF' to my current VBA

    Something like this, perhaps:

    Please Login or Register  to view this content.

  3. #3
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Adding an 'IF' to my current VBA

    I suggest you to keep a separate sheet called Users and in Column-A fill the User Names you would like to add.

    Then change your below line

    If Environ("USERNAME") = "user.name" Then

    To

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  4. #4
    Forum Contributor
    Join Date
    11-02-2011
    Location
    Rugby, England
    MS-Off Ver
    Office 365
    Posts
    846

    Re: Adding an 'IF' to my current VBA

    Thanks, both great solutions!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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