Variable Column Sort

B

Bernie

I need to aIphabetize columns with a set start column, but a variable
range for the end column.


Thanks,
Bern
 
M

Martin Fishlock

Bernie,

Please give us an example so thatr we can see what you are trying to do.
 
R

Roger Govier

Hi Bern

I believe in another posting you said you wanted to keep columns A and B
fixed.
The following code will do that.
Amend the "C:" in the 4th line and the C1 in the 5th line if you need
to vary the start column

Sub SortLefttoRight()
Dim col As String
col = Application.InputBox("Enter last column Letter")
Columns("C:" & col).Select
Selection.Sort Key1:=Range("C1"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
End Sub
 
C

Chip Pearson

Bernie,

What determines what is to be the end column?


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)
 
Top