VBA If statement not resolving correctly

  • I have a function where a string and a string-based array are passed in.

    Using the VBE Watch function I can see the string passed in is:

    TD1a/b/ PMO & CT

    The array contains:

    TD1a/b/ PMO & CT
    TD1a/b/ PMO & CT

    The line:

    If staffName = whichArray(intCount) Then

    is resolving to False, in other words it's skipping to the Else part, even when intCount = 0 or 1.

    However if I run it when the string and array contain "TD1" it works fine.

    Seems like either the /, space or & are causing issues?

    Also posted here: http://www.mrexcel.com/forum/e…orrectly.html#post4594932

  • Re: VBA If statement not resolving correctly

    You have the great opportunity in this forum to attach file, this help seriously to understand the issue: Please use it and send a sample of your file

    Triumph without peril brings no glory: Just try

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!