Results 1 to 7 of 7
  1. #1
    Bronze Lounger
    Join Date
    Sep 2007
    Posts
    1,203
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Find and update (2002)

    I'm confusing myself in loops again...... Hopefully I'm making sense...
    Attached Images Attached Images

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

    Re: Find and update (2002)

    Could you post the code instead of a picture? Otherwise I have to type it in from your picture <img src=/S/sad.gif border=0 alt=sad width=15 height=15>

  3. #3
    Bronze Lounger
    Join Date
    Sep 2007
    Posts
    1,203
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Find and update (2002)

    I'm never sure what the correct code tag is in the lounge?

    Afterthought deleted as error.
    Attached Files Attached Files

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

    Re: Find and update (2002)

    If you want to post indented code, you can either place <!t>[pre] above the code and <!t>[/pre] below it. Make sure that the lines aren't too long, for text between these tags isn't wrapped automatically.
    Or you can replace the number of spaces you use for indenting code with <!t>[tab]. I use a macro in Word for that, see <post:=346,967>post 346,967</post:>.

    Does this do what you want?

    Dim x As Long
    Dim z As Range
    Dim rg1 As Range
    Dim rg2 As Range

    x = Cells(Rows.Count, 1).End(xlUp).Row

    Set rg1 = ws1.Range("H2:H" & x)

    For Each z In rg1
    If z.Value = "HBBA 99 6506" Then
    z.Offset(0, -7).Interior.ColorIndex = 3
    z.Offset(0, -7).Font.ColorIndex = 0
    Set rg2 = ws2.Range("A:A").Find(What:=z.Offset(0, -6), _
    LookIn:=xlValues, LookAt:=xlWhole)
    If Not rg2 Is Nothing Then
    z.Offset(0, -4) = rg2.Offset(0, 6)
    End If
    End If
    Next z

  5. #5
    Bronze Lounger
    Join Date
    Sep 2007
    Posts
    1,203
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Find and update (2002)

    Thankyou Hans.

    I think it will work (test tomorrow). It has grown somewhat and I have one remaining question (attached) (Not used tags as long code)
    Attached Files Attached Files

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

    Re: Find and update (2002)

    I don't quite understand your description, but I think you need a nested If ... End If or perhaps an ElseIf ... End If

  7. #7
    Bronze Lounger
    Join Date
    Sep 2007
    Posts
    1,203
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Find and update (2002)

    I think this does it.

    Cheers
    Attached Files Attached Files

Posting Permissions

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