VBA Code to sort an Excel Column in Ascending Order and Expand Selection? -


i attempting sort column d in ascending order in excel file vba. expand selection values in column a-f.

i've used formula starting point:

sort ascending/descending vba excel

it sorts 1 column , in descending order. having trouble finding more examples.

lastrow = .cells(.rows.count, "d").end(xlup).row  if (.range("d2").value > .range("d" & cstr(lastrow)))     xlsort = xlascending end if  .range("d2:d" & lastrow).sort key1:=.range("d2"), order1:=xlsort, header:=xlno, _ ordercustom:=1, matchcase:=false, orientation:=xltoptobottom, _ dataoption1:=xlsortnormal 

here answer:

.range("d1") = "index" .columns("a:f").sort key1:=range("d2"), _ order1:=xlascending, header:=xlyes 

thanks simoco's comment!


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -