Results 1 to 3 of 3
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    go to in to cell if condition not existis... (2000 sr 1)

    Hi,
    I have used this script to test if a cell is filled.
    My proble is:
    how to redirect into cell if the condition not is respected...
    Example:
    I insert a value into G6, if F6 not is filled appear a msg box "MANCA SPORTELLO! CONTROLLARE, PREGO." and after this message redirect into F6 to force the entry a value...
    But if the condition not is respected in other cells how to redirect automaticly into cell without value?
    I have simple insert after the msg box range ("F6").select no have idea to standardize this process for other cells... in thgis case the control redirect is only in one cell and not for every other cell...

    Very long code fragment moved to attachment by HansV. Please don't include such long pieces of code in the body of the post!

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: go to in to cell if condition not existis... (2000 sr 1)

    You can replace

    If Range("G6") > 0 And Range("F6") = "" Or _
    Range("G9") > 0 And Range("F9") = "" Or _
    Range("G12") > 0 And Range("F12") = "" Or _
    Range("M6") > 0 And Range("L6") = "" Or _
    Range("M9") > 0 And Range("L9") = "" Or _
    Range("M12") > 0 And Range("L12") = "" Then
    MsgBox "MANCA SPORTELLO! CONTROLLARE, PREGO."
    Range("F6").Select
    Exit Sub
    End If

    with

    Dim oCell As Range
    For Each oCell In Range("G6, G9, G12, M6, M9, M12")
    If oCell > 0 And oCell.Offset(0, -1) = "" Then
    MsgBox "MANCA SPORTELLO! CONTROLLARE, PREGO."
    oCell.Offset(0, -1).Select
    Exit Sub
    End If
    Next oCell

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: go to in to cell if condition not existis... (2000 sr 1)

    ... Good.
    Sal

Posting Permissions

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