Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    May 2002
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Macros in Excel (Excel 2000)

    Help!

    Here it goes...

    I've created a macro that finds my dups but what I need in addition to that is the following:

    IF Employee number = the Next employee number THEN
    copy columns E through H for that employee only THEN
    paste the data on the line pertaining to that employee (usually the previous line) THEN
    delete the duplicate row we just copied.
    I know, it's a bit confusing <img src=/S/dizzy.gif border=0 alt=dizzy width=15 height=15> ,but, I have attached a sample copy of the excel spreadsheet along with the macro.

    Hope it helps
    Thanks in Advance!!! <img src=/S/surrender.gif border=0 alt=surrender width=31 height=23>
    Attached Files Attached Files

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macros in Excel (Excel 2000)

    Try something like this:

    <pre>Sub Copy()
    Dim I As Long, J As Long, lMax As Long
    With Worksheets("Sheet1")
    imax = Range("A65536").End(xlUp).Row
    For I = imax - 1 To 1 Step -1
    For J = 1 To I - 1
    If .Range("A1").Offset(I, 0).Value = .Range("A1").Offset(J, 0).Value Then
    Range(.Range("E1").Offset(I, 0), .Range("H1").Offset(I, 0)).Copy _
    Destination:=.Range("I1").Offset(J, 0)
    .Range("A1").Offset(I, 0).EntireRow.Delete
    End If
    Next J
    Next I
    End With
    End Sub
    </pre>

    Legare Coleman

  3. #3
    Star Lounger
    Join Date
    May 2002
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macros in Excel (Excel 2000)

    Wow, that is absolutely fascinating. <img src=/S/clapping.gif border=0 alt=clapping width=19 height=23>

    It worked perfectly.
    Thanks a million <img src=/S/salute.gif border=0 alt=salute width=15 height=20>

Posting Permissions

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