pwm2017
pwm2017

Reputation: 83

Sort data in range of Columns by value in one Column

I am trying to sort data in range Range("G1:J" & LastrowProjectList) alphabetically by the value in column H. The following code does not work. I know the problem is the .Range("H"), but I don't know how to fix this. My data does not have headers. Data starts on row 1.

Sheets("VBA_Data").Range("G1:J" & LastrowProjectList).Sort Key1:=Sheets("VBA_Data").Range("H"), Order1:=xlAscending

Upvotes: 0

Views: 36

Answers (1)

Mrig
Mrig

Reputation: 11702

Try

Sheets("VBA_Data").Range("G1:J" & LastrowProjectList).Sort Key1:=Sheets("VBA_Data").Range("H1:H" & LastrowProjectList), Order1:=xlAscending

.Range("H"), Order1:=xlAscending should be .Range("H1:H" & LastrowProjectList), Order1:=xlAscending

Upvotes: 2

Related Questions