ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   sorting data in 2 columns on column 1 (https://www.excelbanter.com/excel-programming/347915-sorting-data-2-columns-column-1-a.html)

Pierre via OfficeKB.com[_2_]

sorting data in 2 columns on column 1
 
Hi,

How can i, in vba, sort colum F and G on the value in column F.
Thanks,
Pierre

--
Message posted via http://www.officekb.com

Tom Ogilvy

sorting data in 2 columns on column 1
 
Range("F:G").sort Key1:=Range("F1"), Header:=xlYes

--
Regards,
Tom Ogilvy


"Pierre via OfficeKB.com" <u13950@uwe wrote in message
news:58bbf03d73d85@uwe...
Hi,

How can i, in vba, sort colum F and G on the value in column F.
Thanks,
Pierre

--
Message posted via http://www.officekb.com




Pierre via OfficeKB.com[_2_]

sorting data in 2 columns on column 1
 
Hi Tom,

As allways : THANKS !!!
but i think i put my question a little wrong...

My data does not start in F1 but in F4.... and the length of the list is
dependent on the users input (can be 20 items, can be 50 items).

How can i adapt your code ?
Pierre

P.S. My data does not start in F1 but in F4.... and the length of the list is
dependent on the users input (can be 20 items, can be 50 items).


Tom Ogilvy wrote:
Range("F:G").sort Key1:=Range("F1"), Header:=xlYes

Hi,

How can i, in vba, sort colum F and G on the value in column F.
Thanks,
Pierre


--
Message posted via http://www.officekb.com

Dave Peterson

sorting data in 2 columns on column 1
 
Maybe...

with activesheet
with .range("f4:G" & .cells(.rows.count,"F").end(xlup).row)
.sort key1:=.columns(1), header:=xlyes
end with
end with

The last cell in the F:G range is based on the bottom most cell in column F.



"Pierre via OfficeKB.com" wrote:

Hi Tom,

As allways : THANKS !!!
but i think i put my question a little wrong...

My data does not start in F1 but in F4.... and the length of the list is
dependent on the users input (can be 20 items, can be 50 items).

How can i adapt your code ?
Pierre

P.S. My data does not start in F1 but in F4.... and the length of the list is
dependent on the users input (can be 20 items, can be 50 items).

Tom Ogilvy wrote:
Range("F:G").sort Key1:=Range("F1"), Header:=xlYes

Hi,

How can i, in vba, sort colum F and G on the value in column F.
Thanks,
Pierre


--
Message posted via http://www.officekb.com


--

Dave Peterson

Tom Ogilvy

sorting data in 2 columns on column 1
 
Dim rng as Range
set rng = Range(Range("F4"),Range("F4").End(xldown)).Resize( ,2)
rng.Sort Key1:=Range("F4"),Header:=xlGuess

--
Regards,
Tom Ogilvy


"Pierre via OfficeKB.com" <u13950@uwe wrote in message
news:58bc54b178429@uwe...
Hi Tom,

As allways : THANKS !!!
but i think i put my question a little wrong...

My data does not start in F1 but in F4.... and the length of the list is
dependent on the users input (can be 20 items, can be 50 items).

How can i adapt your code ?
Pierre

P.S. My data does not start in F1 but in F4.... and the length of the list

is
dependent on the users input (can be 20 items, can be 50 items).


Tom Ogilvy wrote:
Range("F:G").sort Key1:=Range("F1"), Header:=xlYes

Hi,

How can i, in vba, sort colum F and G on the value in column F.
Thanks,
Pierre


--
Message posted via http://www.officekb.com





All times are GMT +1. The time now is 05:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com