order1=xlascending

  1. kweaver

    VBA going sort crazy

    What is wrong with this? lastrow is set (e.g., it's 100), there are headers in row 4. The error is that the "sort reference is not valid." Worksheets("Reformatted").Range("A4:L" & lastrow).Sort Key1:=Range("H4"), Order1:=xlAscending, Header:=xlYes
  2. C

    Sort a worksheet

    I have a worksheet with columns A through R. I need to sort this worksheet by the value that is in Column C. I have searched for the answer and have tried several suggestions, but the worksheet never sorts. In my code below I have commented out all the things I have tried. Is what I am trying to...
  3. I

    Help with Deactivate

    I'm having trouble with the Deactivate. The code works now but it keeps taking me back to the original page and not the page the user is trying to select. I'm probably doing something dumb but I can't figure it out. Thanks for any help! Private Sub Worksheet_Deactivate() Sheet5.Select...
  4. E

    Option Button/Sorting

    The project has grown and has a few pains still and this is one. Sometimes it will work and sometimes it doesn't and not sure why. The objective is to sort on Col "J " within a range. Seems simple. We never allow more than 50 entries, so I first setup the range @ "A2:A50", but if there were...
  5. L

    Sorting with vba, custom sort?

    Hi all, I am trying to sort a table in excel, I have the following code so far: <code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit; line-height: 12px;">Sub Sort_Table() Sheet6.ListObjects("Sort_table").Range.Sort...
  6. M

    Complex FOR Statement

    I can't seem to get this code to work. Any ideas? This is my first time using a FOR statement in VBA. Sub Sort() Dim x As Long Dim ws As Worksheet For x = 1 To 8 Set ws = ThisWorkbook.Sheets("P" & x & " Figure 2-2") Lr = ws.Range("A" & Rows.Count).End(xlUp).Row If Lr > 3 Then...
  7. Emerlin

    VBA Auto sort looking at if changes in other sheets for changes?

    Hi, I am using this VBA script to get some sorting done. But my cells reference formulas on other sheets that do not trigger it as the cell changing - hope that makes sense. Can I nest and Else if to look at the other sheets to trigger the changes? Working... Private Sub...
  8. T

    Add Sort Condition

    Hi I have the below sort which just uses I4:I28 etc as the asending sort what would below look like if I wanted to firstly sort F4:F28 in the order "Active then Inactive then extra" and then sort I4:I28 ascending for below rows Sub TestSort() ActiveSheet.Unprotect Range("4:28").Sort...
  9. T

    Entire Row Sort

    Hi I have the below macro that that sorts for example ranges A5:CD22 based on B5:B22 sort selection. How would it look if instead of selecting the specific ranges as above but rather I wanted to sort entire rows 5:22 based on B5:B22 sort selection? Any help would be great. Thanks Stephen Sub...

Some videos you may like

This Week's Hot Topics

Top