Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 122
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 122
Default 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
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
sorting ranges of various column lengths, lookup values in columns mrphinney Excel Worksheet Functions 0 May 14th 09 07:51 PM
Sorting 5 columns of data based on column A CAT Excel Discussion (Misc queries) 6 September 27th 08 02:10 AM
Sorting Data into columns without replacing the columns with data Sandaime New Users to Excel 2 October 18th 07 01:35 PM
Sorting Data From One Column into Multiple Columns Justin Hoffmann Excel Worksheet Functions 2 July 12th 06 04:15 PM
In Excel, sorting columns automatically by clicking column title Destiny Excel Discussion (Misc queries) 1 June 23rd 05 06:39 PM


All times are GMT +1. The time now is 12:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"