+ Reply to Thread
Results 1 to 3 of 3

need advice on 0, "" , " "

Hybrid View

  1. #1
    AskExcel
    Guest

    need advice on 0, "" , " "

    Hi All,

    I do not know what is the best way for the below syntax. Any better function
    instead of using 0, "" or " " although it can work. Now I afraid if user
    enter " " which is 2 spaces then the program unable to detect.
    Need the advice.
    Thanks

    If qty = 0 Or qty = " " Or qty = "" _
    Or item = " " Or item = "" Then
    MsgBox ("Part Number and Quantity Must Input!")

  2. #2
    Die_Another_Day
    Guest

    Re: need advice on 0, "" , " "

    you can use this to detect a variable amount of spaces.
    if qty = Space(Len(qty))
    is your part number all numeric? is there a way you can check a list to
    see if it matches and return an error if it doesn't?

    HTH

    Die_Another_Day
    AskExcel wrote:
    > Hi All,
    >
    > I do not know what is the best way for the below syntax. Any better function
    > instead of using 0, "" or " " although it can work. Now I afraid if user
    > enter " " which is 2 spaces then the program unable to detect.
    > Need the advice.
    > Thanks
    >
    > If qty = 0 Or qty = " " Or qty = "" _
    > Or item = " " Or item = "" Then
    > MsgBox ("Part Number and Quantity Must Input!")



  3. #3
    ViestaWu
    Guest

    RE: need advice on 0, "" , " "

    Hello,

    I suggest you could use function TRIM(text). TRIM() could get rid of the
    space on both sides and keep one space between two words.If you define
    variable as string, you can do as follows:

    if trim(qty)="" or trim(qty) = "0" then
    ....

    Hope it works!

    Viesta
    Shanghai, CN

    "AskExcel" wrote:

    > Hi All,
    >
    > I do not know what is the best way for the below syntax. Any better function
    > instead of using 0, "" or " " although it can work. Now I afraid if user
    > enter " " which is 2 spaces then the program unable to detect.
    > Need the advice.
    > Thanks
    >
    > If qty = 0 Or qty = " " Or qty = "" _
    > Or item = " " Or item = "" Then
    > MsgBox ("Part Number and Quantity Must Input!")


+ 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