order=xlascending

  1. R

    custom sort not applying

    I've recorded a custom sort. The sort works exactly how I want, when manually applied (during record process), but fails to apply when applied by executing recorded vba code; by fail, I mean not applying sort and no error messages displayed. After the code has completed, I can visit the "Custom...
  2. 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)...
  3. S

    Sort a worksheet by Colour

    Morning all I have a worksheet "Project Summary" Columns A to L which is a summary of another worksheet "Project Master" Columns A to BW. ONce the data is pulled through from "Project Master" I am using the following code to sort the "Project Summary" sheet: Sub SortMultipleColumns() With...
  4. E

    Change range in a sort macro

    Hi all, I am working on this sheet and I need a lot of data to be sorted in a specific manner. The only issue is that the data I use changes. One week I may have 5000 rows of data in Excel, and others I may have 6000. Is there a way to make the sorta range in this code here change based on how...
  5. T

    Add Sort Function To A Varying Length Spreadsheet

    Hi all, I am trying to add a sort function to a spreadsheet that varies in length, however the code stops when it gets to the .Apply section, does anyone know how to fix this? See the code below: LastRow = sht.Range("A1").CurrentRegion.Rows.Countsht.Range("A2", sht.Range("k" & LastRow)).Select...
  6. 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...
  7. A

    Object variable or with block variable not set

    I have a worksheet I am trying to create a filter for. I recorded a macro with all of the filtering set to what I need. When I try to assign it to my ComboBox and run it I am getting a Run-Time Error 91 Object variable or with block variable not set. It is highlighting the section "...
  8. S

    VBA sort by two columns and add row after first sort based on cell

    I have the below code to sort my data by color (K11:K123) and by item (C11:C123). Is there a way to have a blank row inserted (also have all formulas of all other cells) to separate when the color changes. Range("B11:M123").Select ActiveWindow.SmallScroll Down:=-102...
  9. 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...
  10. S

    VBA Sort By 2 Columns On Certain Worksheets Within A Workbook

    I created the following code to sort one sheet by 2 columns, but I would like to change the code to include other sheets (but not all the sheets w/in the workbook). How can I do that? All the data will be in the same columns and cells on each sheet. Also, can I still use the sheet names or...
  11. 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")...
  12. D

    Macro recorder filter optimization

    Using macro recorder to filter column C (by name) and then column E (by hour/date) I get the following code. Sub Macro1() ActiveWorkbook.Worksheets("SheetA").Sort.SortFields.Clear ActiveWorkbook.Worksheets("SheetA").Sort.SortFields.Add2 Key:=Range("C2:C500") _ ...
  13. F

    Macro edit - tab character limit

    Good morning, I have a macro that organizes data and then splits that data into different tabs based on a name in column AC. The issue I just ran into was when the name was too long for a tab (character limit I believe is 30). Is there a way to update this macro to either read only to the 30th...
  14. 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...
  15. 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...
  16. S

    VBA Data Sort (Keep Cell Formating while Only Moving Text)

    Hi, I currently have a code that automatically sorts data on multiple worksheets when the workbook is open and it works fine. Most cells in the E9:J28 Range have no fill colour; however, there are some cells (in rows) that are intentionally blacked out. Can anyone help me out to tweak this VBA...
  17. S

    Sorting Columns Using VBA

    This one's driving me nuts. I have code to sort the active sheet of an xlsm file. Below is the code: With ActiveSheet.Sort .SortFields.AddKey:=Range("A2:A75000"), Order:=xlAscending .SortFields.AddKey:=Range("B2:B750000"), Order:=xlAscending...
  18. jbesclapez

    VBA difference in Sort with: Add2 and Add (.SortFields.Add2 VS .SortFields.Add)

    Hello, I sent a macro to another computer only to realize that it did not work because of a Sort issue in the code. With ActiveWorkbook.Worksheets("APP").Sort .SortFields.Clear .SortFields.Add2 Key:=Range("B2:B" & LastA), Order:=xlAscending .SortFields.Add2 Key:=Range("A2:A" &...
  19. S

    Loop recorded macro through all worksheets

    Hi, I am trying to loop a one worksheet (name of that worksheet was Booking)recorded macro through all the sheets in the workbook. The recording was to sort data within a range alphabetically. No security issues I am aware of. If anyone could amened the following code to this, that'd be...
  20. S

    Sorting multiple range but error

    hi below is my macro.. with error reference is not valid. i went though the web but can't find answer that satisfy me. Please help Range("A8:Q500").Select ActiveWorkbook.Worksheets("NAVAnalysisChk").QueryTables(1).Sort.SortFields. _ Clear...

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