Results 1 to 7 of 7

Thread: [RESOLVED] Useful two table line up excel

Hybrid View

  1. #1
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Useful two table line up excel

    try this
    VB Code:
    1. Sub lineup()
    2. i = 3
    3. Do Until i = ActiveSheet.UsedRange.Rows.Count
    4.     If Not IsEmpty(Cells(i, 1)) And Not IsEmpty(Cells(i, 9)) Then
    5.         If Cells(i, 1) > Cells(i, 9) Then
    6.             Range(Cells(i, 1), Cells(i, 4)).Insert xlDown
    7.            
    8.         ElseIf Cells(i, 1) < Cells(i, 9) Then
    9.             Range(Cells(i, 9), Cells(i, 13)).Insert xlDown
    10.         ElseIf Cells(i, 1) = Cells(i, 9) Then
    11.             If Cells(i, 2) > Cells(i, 10) Then
    12.                 Range(Cells(i, 1), Cells(i, 4)).Insert xlDown
    13.             ElseIf Cells(i, 2) < Cells(i, 10) Then
    14.                 Range(Cells(i, 9), Cells(i, 13)).Insert xlDown
    15.             End If
    16.            
    17.         End If
    18.     End If
    19.         i = i + 1
    20.        
    21. Loop
    22. End Sub
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2005
    Posts
    393

    Re: Useful two table line up excel

    Hi,

    Getting there, for some reason , it does not work if the very bottom ones are different on both tables are different.
    It seem to get lost at the very bottom few lines. try changing a few
    Any ideas

Posting Permissions

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



Click Here to Expand Forum to Full Width