Results 1 to 3 of 3

Conditional sorting problem

Threaded View

  1. #1
    Registered User
    Join Date
    01-02-2014
    Location
    Calgary,Alberta
    MS-Off Ver
    Excel 2003
    Posts
    2

    Conditional sorting problem

    I am reasking this post as likely the information wasnt clear on the first post.
    I am trying to use a sort I copied from the forum posts but I am unable to create the Else condition correctly.
    The spreadsheet is attached, I am trying to copy data from the "InstData" sheet to the "RawData" sheet and have it transfer in the "goal" order. The condition or the loop is constructed incorrectly. The negative condition should transfer the remainder of the rows which are not in the positive condition.

    Thank you Ron

    module 2
    Sub aaCopytoRawData()
    
        Application.ScreenUpdating = False
        Sheets("InstData").Activate
        
    Dim lastrow, lastcolumn As Integer
        lastrow = Cells(Rows.Count, 4).End(xlUp).Row
        lastcolumn = ActiveSheet.Range("a1").End(xlToRight).Column
        
    Dim X, Y, P, Z As Integer
        
    With Worksheets("InstData")
            
    For P = 1 To 13
    For Z = 1 To lastrow
    For X = 1 To lastrow
    For Y = 1 To lastcolumn
     
        If Worksheets("InstData").Cells(X, 1) = Worksheets("Config").Cells(P + 6, 8) Then
        Worksheets("RawData").Cells(P, Y) = .Cells(X, Y)
            'Else: Worksheets("RawData").Cells(Z, Y) = .Cells(X, Y)
        End If
    
    Next Y
    Next X
    Next Z
    Next P
    
    End With
          
    Sheets("RawData").Activate
    Range("b2").Select
            
    End Sub
    Attached Files Attached Files
    Last edited by Leith Ross; 01-10-2014 at 09:00 PM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Conditional Sorting
    By djh30 in forum Excel General
    Replies: 2
    Last Post: 07-08-2013, 01:23 PM
  2. conditional sorting
    By Ahmad1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-24-2011, 07:04 AM
  3. Conditional sorting
    By Psyke45 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-24-2007, 10:51 AM
  4. [SOLVED] Sorting problem
    By Bri in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-27-2006, 08:40 PM
  5. Conditional Sorting
    By Rob in forum Excel General
    Replies: 1
    Last Post: 09-16-2005, 09:05 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1