Results 1 to 15 of 15

Thread: [RESOLVED] Sorting two matrices

Hybrid View

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

    Re: Sorting two matrices

    @ funky
    Also, I'd advise against attaching zips
    in this forum, you can not attach workbooks without zipping, better to post the code, though in this case he has no code at all, but often sample data is required to test

    @ arithos
    what have you tried so far?
    there is no indication of this in your wokbook
    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
    Junior Member
    Join Date
    Jun 2014
    Posts
    16

    Resolved Re: Sorting two matrices

    Hi again,

    @westconn1: You are correct I could not attach xls, or xlsx here, and my exceeded the limit when I tried xml. Hence, a zip was the result.

    And, my attempt thus far includes making the macro insert different
    "=IF(AND(maaany criterias);"Command if criterias hold";"")"
    and use a simple:

    For x=1 to LR(last row in my code)

    If "Command if criterias hold" then

    My code for moving to different sheets, sorting via inserting new IF statements.

    End if

    Next x

    And repeat....

    This is time consuming, and contains an error = Me, and my ability to create good formulas.

    and example of IF statement inserted into the "Start" sheet in my .zip

    Sheets("Start").Select
    LR = [counta(A:A)-1]
    Range("L1").Select
    ActiveCell.FormulaR1C1 = _
    "=IF(AND(RC[-9]=0,RC[-8]=0,RC[-4]=0,RC[-2]=0),""Skip"","""")"
    Selection.AutoFill Destination:=Range(Cells(y, 12), Cells(LR, 12))


    then I loop this:

    If Not Cells(y, 12) = "Skip" Then

    Cells(y, 1).Select
    Selection.Resize(Selection.Rows.Count, Selection.Columns.Count + 10).Select

    FE = Selection.Copy

    Sheets("Finish").Select
    Cells(1, 1) = "x"
    Cells(2, 1) = "xx"

    Cells(1, 1).Select
    Selection.End(xlDown).Offset(1, 0).Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Sheets("Start").Select
    End If
    Next y


    And I perform this type of approach to create the end result, which does not always yield a perfect one. (Some values are pasted overeachother and "disappear" )


    I have also tried different sorting approaches, but theese fails if there are too many observations not registered with either the left or right side of my DataSet.

    I hope this gave some insight into what I have done thus far, I'm sure there is an easier way to do it, and hope someone might be able to enlighten me

Tags for this Thread

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