Sorting sheet by column before i open userformadvice

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,890
Office Version
  1. 2007
Platform
  1. Windows
I am trying to sort a sheet by column & then open my userform.
I have the below but i dont see anything happen

SOME INFOR FOR YOU.
Headers on row 6
Row 7 is hidden.
First row of values are at row 8
I wish to sort column D from A-Z

In the code supplied, The line shown in Red im not sure what the value is where i entered 4 as i thought it was the column to sort by ?
See screenshot please

EaseUS_2025_01_30_11_00_23.jpg



Rich (BB code):
Private Sub ConnectorUsed_Click()
    Dim x As Long
        Application.ScreenUpdating = False
        With Sheets("MCLIST")
        If .AutoFilterMode Then .AutoFilterMode = False
        x = .Cells(.Rows.Count, 4).End(xlUp).Row
            .Range("A8:L" & x).Sort Key1:=Range("A8"), Order1:=xlAscending, Header:=xlGuess
    End With

End Sub
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Try it.
Modify
.Range("A8:L" & x).Sort Key1:=Range("A8"), Order1:=xlAscending, Header:=xlGuess
to
.Range("A8:L" & x).Sort Key1:=Range("D8"), Order1:=xlAscending, Header:=xlNo
 
Upvote 0

Forum statistics

Threads
1,226,116
Messages
6,189,055
Members
453,523
Latest member
Don Quixote

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