+ Reply to Thread
Results 1 to 6 of 6

Sort

  1. #1
    Registered User
    Join Date
    02-10-2012
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    8

    Sort

    I'm having a sort issue. I can get everything to paste the way I want but I cannot get it to then sort without setting up a seperate sort button on the page. Here is the code I am using. When I transfer I get an error that highlights the area below.

    Range("C7:C20").Select
    Selection.Copy
    Sheets("Engineering Backlog").Range("A" & CStr(Sheets("Engineering Backlog").Range("A1").CurrentRegion.Rows.Count + _ 1)).PasteSpecial _ Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
    Sheets("Engineering Backlog").Range("A1:N500").SORT Key1:=Range("F2"), Order1:=xlAscending, Key2:= _ Range("H2"), Order2:=xlAscending, _ Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:=xlSortNormal
    Sheets("Data Loader").Range("C7:C20").ClearContents

    End Sub

    Can someone please show me what I am doing wrong so I can correct this?

    Thanks for looking,
    Dave
    Last edited by dpalm; 02-17-2012 at 09:37 AM. Reason: It's solved

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Need Help with Sort

    Please upload the file that you are using with the code.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    02-10-2012
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Need Help with Sort

    I should have thought of that first. Here is a copy.

    Attachment 141719

    Thanks!
    Dave

  4. #4
    Registered User
    Join Date
    02-10-2012
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Need Help with Sort

    I should mention that, for the time being, I have changed the code so that it only transfers from the data loader sheet to the engeering backlog sheet. From there, I sort using the command buttons at the top.

    Thanks,
    Dave

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Sort

    I changed your code to this -
    Please Login or Register  to view this content.
    Some observations:
    1. Your sort code is included in the copy paste code.
    2. Your earlier code had many underscore characters which were not allowing it to work,
    3. You must have observed that your file was nearly 13MB in size with hardly much data. I went to each tab and deleted all the rows after the last row of data. This has brought down the size to 158kb. You can do the same at your end.

    Do let me know if you have any other questions.

  6. #6
    Registered User
    Join Date
    02-10-2012
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Sort

    Thanks So Much! It works perfect now. This workbook was something I inherited so it has been a chore. I'm just learning how to code so thanks again.

    Dave

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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