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

    find value and stop macro.... (2000 r s1)

    assuming have a filled var:

    VAR_PER = DECADELE
    VAR_DATE = 31/01/2005
    (All var are AS STRING)

    my idea...

    if VAR_PER & VAR_DATE are the same value from a joint of line into column C and column H, make to apper a msg box "value alreday present" exit sub..

    example: VAR_PER & VAR_DATE ( DECADELE & 31/01/2005 ) is the same value joined in line 269 (is the first line with this condition) make to apper a msg box "value alreday present" exit sub..

    if VAR_PER & VAR_DATE are the same value from a joint of line into column C and column H, make to apper a msg box "value alreday present" exit sub..

    example: VAR_PER & VAR_DATE ( DECADELE & 10/01/2005 ) is the same value joined in line 5 (is the first line with this condition) make to apper a msg box "value alreday present" exit sub..

    ecc...

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

    Re: find value and stop macro.... (2000 r s1)

    Enter the formula =C5&H5 in cell I5 and fill down to the end, for example by double-clicking the fill handle in the lower right corner of cell I5.

    Use the following code:

    Dim rng As Range
    Set rng = Range(Range("I5"), Range("I5").End(xlDown)).Find( _
    What:=VAR_PER & VAR_DATE, LookIn:=xlValues, LookAt:=xlWhole)
    If Not rng Is Nothing Then
    MsgBox "Value already present"
    Exit Sub
    End If

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

    Re: find value and stop macro.... (2000 r s1)

    Naturally !!!! WOW!
    Sorry for delay.
    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
  •