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

    Return number of line...(.row) (2000)

    Have var1 filled="4C" and var2 filled="CAMPANIA"
    How to return in variable var_number_line the number of line where var1 and var2 are on the same line?
    In this case var_number_line =9

  2. #2
    5 Star Lounger
    Join Date
    Apr 2003
    Location
    Hampshire, United Kingdom
    Posts
    602
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Return number of line...(.row) (2000)

    Are you looking for a solution as an Excel formula or VBA code? The latter is quite straightforward:


    Sub FindRow()
    Dim var1 As Variant, var2 As Variant, r As Range
    var1 = "4C"
    var2 = "CAMPANIA"
    Set r = Foglio6.Range("G2")
    Do Until (r = var1 And r.Offset(0, 7) = var2) Or IsEmptyŽ
    Set r = r.Offset(1, 0)
    Loop
    If r = var1 And r.Offset(0, 7) = var2 Then
    MsgBox "Required row is " & r.Row
    Else
    MsgBox "Couldn't find specified combination"
    End If
    End Sub
    Waggers
    If at first you do succeed, you've probably missed something.

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

    Re: Return number of line...(.row) (2000)

    Good code!
    Work fine, tks.

Posting Permissions

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