Results 1 to 3 of 3

Thread: Logic

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2008
    Posts
    167

    Logic

    if he cell 4 e has not ABCD AND CELL 5 6 Mid position not M
    DISPLAY MSG BOX
    AND if cell 4e has = ABCD OR NOT abcd
    do something
    The below code i tried
    when it is not ABCD AND =m
    it shows msg box
    what is wrong in this logic
    IF Ucase(aSheet.cells(4, "e")) <> "ABCD" AND mid(aSheet.Cells(5,"e"), 6, 1) <> "M" THEN
    MsgBox ("Excell Cell E5 6th position should be M'")
    MyScreen.Sendkeys ("<pf3>")
    Exit Sub
    End IF
    if Ucase(aSheet.cells(4, "e")) <> "ABCD" or = "ABCD"
    DO SOMEHTING
    END IF

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Logic

    if Ucase(aSheet.cells(4, "e")) <> "ABCD" or = "ABCD"
    this line is wrong
    this would be more correct
    if Ucase(aSheet.cells(4, "e")) <> "ABCD" or Ucase(aSheet.cells(4, "e"))= "ABCD"
    but then it is if it is equal or not equal so pointless

    what else is working incorrectly?
    and what is it doing?
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Mar 2008
    Posts
    167

    Re: Logic

    westconn
    figured out . ABCD was lower case. corrected. now it is working

Posting Permissions

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



Click Here to Expand Forum to Full Width