+ Reply to Thread
Results 1 to 8 of 8

if statemnts

  1. #1
    Forum Contributor
    Join Date
    12-16-2006
    Posts
    349

    Red face if statemnts

    Please Login or Register  to view this content.

    this macro currently only runs if ali opens the file I want to run it if Tom or Micheal or John opened it and if anyone else did then do nothing , how can I adapt this macro to do that .. anyhelp
    Last edited by VBA Noob; 12-24-2006 at 01:50 PM.

  2. #2
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by khalid79m
    Please Login or Register  to view this content.

    this macro currently only runs if ali opens the file I want to run it if Tom or Micheal or John opened it and if anyone else did then do nothing , how can I adapt this macro to do that .. anyhelp
    Hi,
    amend

    If ActiveCell.Value = "ali" Then
    to

    If ActiveCell.Value = "ali" or ActiveCell.Value = "tom" or ActiveCell.Value = "michael" or ActiveCell.Value = "john" Then

    also, as previously advised,

    If LCase(Range("A10").Value) = "ali" then

    use the lowercase for testing, probably as

    If LCase(ActiveCell.Value) = "ali" then


    hth
    ---
    Last edited by Bryan Hessey; 12-24-2006 at 02:31 PM.
    Si fractum non sit, noli id reficere.

  3. #3
    Forum Contributor
    Join Date
    12-16-2006
    Posts
    349

    Wink dont understand

    also, as previously advised, amend

    ActiveCell.Value = Application.UserName
    to lowercase for testing purposes


    I dont understand what you mean, all the usernames will be in lowercase anyway as I will set them on each users PC alongside their staff number ie

    markhepper0145648

  4. #4
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by khalid79m
    also, as previously advised, amend

    ActiveCell.Value = Application.UserName
    to lowercase for testing purposes


    I dont understand what you mean, all the usernames will be in lowercase anyway as I will set them on each users PC alongside their staff number ie

    markhepper0145648
    Yes it was amended, I didn't hit the correct line to Lowercase.

    the reason for lowercase? - your question was " if Tom or Micheal or John " - and they're not lowercase.

    It's something that gets overlooked, it may be simple here to use login names and say that you are always sure of the lowercase, but your question proves that wrong.

    As mudraker suggested, use the lowercase, it's good practice and you'll spend less time with hassles when it really counts.

    hth
    ---

  5. #5
    Forum Contributor
    Join Date
    12-16-2006
    Posts
    349

    timeout help

    also in response to my initial question re if statement

    is there an easier way to do it as i need to run the macro for 20 different people out of about 700 who will access the file , could i just do seperate if statement for each one or can you word wrap the script some how ?

  6. #6
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by khalid79m
    also in response to my initial question re if statement

    is there an easier way to do it as i need to run the macro for 20 different people out of about 700 who will access the file , could i just do seperate if statement for each one or can you word wrap the script some how ?
    20? - I didn't read that into your post. I saw 3 additional people, for which the answer was given.

    For a list, something like
    Please Login or Register  to view this content.
    should work for you.

    ---
    added, for the 'wrap' the Help on wrap shows how to wrap in a cell, with a wrap in that instruction.
    ---
    Last edited by Bryan Hessey; 12-24-2006 at 03:04 PM.

  7. #7
    Forum Contributor
    Join Date
    12-16-2006
    Posts
    349

    Lightbulb error

    hi the last code you gave doesnt seem to work

  8. #8
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by khalid79m
    hi the last code you gave doesnt seem to work
    Hi, yes, at 7:00am it looks different.

    try
    Please Login or Register  to view this content.
    you can remove the msgbox line after testing
    amended to include john
    ---
    Last edited by Bryan Hessey; 12-24-2006 at 05:25 PM.

+ 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