key=range

  1. 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...
  2. Z

    Dynamic Range

    Hi, I have a table that it's macro driven. What I need is to sort this table based on criteria and I have recorded below macro to do that, however, the range is dynamic and it depends on number employees that are reporting to each manager. What I need is how to write a macro that can sort...
  3. D

    clenaner code to sort

    hi guys used the recorder for this finalrow = Cells(Rows.Count, "A").End(xlUp).Row ActiveWorkbook.Worksheets("Domestic NI").Sort.SortFields.Clear ActiveWorkbook.Worksheets("Domestic NI").Sort.SortFields.Add Key:=Range( _ "A10:A" & finalrow), SortOn:=xlSortOnValues...
  4. Dazzawm

    Help With Monotonous Sort Code

    I have to sort many thousand rows by selection but each time I select the rows i want to sort the sort criteria keeps resetting itself. I done a recorded macro but obviously the range of rows change each time. What needs changing in code for the sort to work on my selected rows each time...
  5. D

    Selecting all data on a Worksheet

    I have recorded a macro to sort my worksheet in a specific order and I get the following VBA. Cells.Select ActiveWorkbook.Worksheets("DReg").Sort.SortFields.Clear ActiveWorkbook.Worksheets("DReg").Sort.SortFields.Add Key:=Range( _ "A2:A10"), SortOn:=xlSortOnValues...
  6. J

    Sort By Column D THEN auto-scroll to currently selected Row's Column D value?

    I have code that sorts from A-Z based on Column D's values. After the Sort completes the cursor parks itself at B4. Works fine, but instead of parking at B4 I'd like to have the cursor scroll to the Value that was in Column D for the Row that was selected when the Sort macro was run. Here's...
  7. J

    Sort By Date THEN auto-scroll to current date

    I have a macro that sorts my data based on dates in Column B. As you can see, after the sort completes the cursor parks itself at Cell A1. What I'd like is for it to auto-scroll down to the current date (or closest date) in Column B. Here's my current code: Sub SortByDate()...
  8. A

    VBA custom sort

    I have recorded the following macro while doing my custom sort: Sub sortMembers() Dim ws As Worksheet: Set ws = Worksheets("RefindData") ws.sort.SortFields.Clear ws.sort.SortFields.Add Key:=Range( _ "A2:A9998"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _...

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