.sortfields.add

  1. kweaver

    Sorting Issue - not working as expected

    I have a simple sheet that looks like this: more data And, I'm using the following code within other code in VBA: With ActiveSheet.Sort .SortFields.Add Key:=Range("J1"), Order:=xlAscending .SortFields.Add Key:=Range("C1"), Order:=xlAscending .SetRange Range("A1:V" & LRX)...
  2. F

    Sorting code brings up 1004 Application-defined or Object Defined Error

    The following bit of code brings up the above 1004 error when it gets to .Apply, but for the life of me I can't work out why! Sub DataSort() Dim wsRes As Worksheet, wsPoi As Worksheet Set wsRes = ThisWorkbook.Sheets("Results") Set wsPoi = ThisWorkbook.Sheets("Title Points")...
  3. S

    Sort Populated Data

    Hi, I am trying to sort the populated data in a worksheet. Column A has a few records with the cell blank and I want these at the bottom. I have the code below. It runs with no errors but doesn't seem to be sorting correctly. Sub Sort() Sheets("XXXX").Activate ActiveSheet.UsedRange.Select...
  4. P

    Sorting multiple sheets with variable rows

    Hi All, The following code has some issues.it is working when all rows are same but whenever it needs to sort a sheet with variable rows , it is selecting the cells but not sorting. Pls Help. Sub Sort() Dim i As Long Dim LastARow As Integer LastARow =...
  5. C

    excel vba on change events for sorting if changed from......

    So I have the below code which works perfectly (maybe could be cleaned up a little but its working) what im trying to figure out if right now if column I changed then it runs the sort or if "ETOX-SKIP" is selected from the drop down in column D then it sorts. The thing im trying to figure out...
  6. P

    VBA code for last row instead of naming a range

    Hi please can you help me, i have the code below where i have named a range A28:C41 but the last row might not always be C41 please can you advise how i do a last row please? With ActiveSheet.Sort .SortFields.Add Key:=Range("A28"), Order:=xlAscending .SortFields.Add Key:=Range("B28")...
  7. E

    Sort Error on open

    Recently I added the code below to do some auto sorting with a button. It works great and I don't recall any problems after I first made it (couple weeks ago). Now when I open the file, use the sort button, save it close it and reopen the file, it prompts me to repair the file. If I save the...
  8. L

    Sorting in Excel from Access

    Hello Having tried unsuccessfully to find a solution to the below issue on both google and old threads in this forum I kindly request any suggestions as to how to solve this problem. I'm simply trying to sort a range in an Excel file from Access, but it's erroring with everything I try. My...
  9. K

    Excel VBA sort sometimes stops (but doesn't error)

    This one has been driving me nuts for some time so I'm hoping one of the knowledgeable people here has an answer. I have a massive spreadsheet (11 MB and growing) that I use to track stock trading data. Imbedded w/i the spreadsheet are many RTD functions calling ToS to get real time data on...
  10. L

    Newbie VBA coder struggling with a Run-time error '1004'

    I have a fairly simple macro built that is supposed to delete row 2, bold format font in row 1, auto fit column widths, and sort by column. The number of rows in the worksheet will vary, but the number of columns are the same every time. I've done a lot of searching in forums for the 1004 error...
  11. B

    Sort Multiple Columns Using VBA

    Hello, I have a worksheet and have created this VBA to sort a range with two sort keys. First in descending order on Range N8 as the first key ... Sub sort_ruldown() Application.ScreenUpdating = False Sort.SortFields.Clear With Sort .SortFields.Add Key:=Range("N8")...
  12. A

    VBA Sort Syntax Correct?

    Hi all, My macro runs and saves a created workbook from the macro workbook. But the file that is saved corrupt and excel has to ask if the user wants to recover data whenever these files are produced. I have gone over all my code, and I suspect that the way I am sorting the data is buggy. Is...
  13. G

    I need to fixed this Code Please

    I want to sort some rows only, HELP Please.. Sub xx1()On Error Resume Next With Worksheets("Jan").Sort .SortFields.Clear .SortFields.Add Key:=Range("e:e"), _ SortOn:=xlSortOnValues, _ Order:=xlAscending, _ DataOption:=xlSortNormal .SortFields.Add Key:=Range("e14;e26"), _ SortOn:=xlSortOnValues...
  14. J

    "The Sort reference is not valid"

    I have built a subroutine for doing multi column sorts. The problem is that the error on the subject line does not tell me where it is breaking. Can experts at sorts eyeball this and see if a problem pops out? Option Explicit ' Must declare variables - clean programming technique Public Sub...

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top