#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Sorting

I want to sort information in columns a to columns f the I need this to be
done by macro the problem is when I have a new person come in to the place i
would have to rewrite the code. is the any way at all to have a macro count
the rows start from row 3.

Thanks in advance

Greg


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Sorting


I want to sort information in (columns a : columns f) I need this to be
done by macro. The problem I am having is when I have a new person come in
to the place i
would have to rewrite the code. Is there any way at all to have a macro
count the rows, starting from row 3.

Thanks in advance

Greg


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sorting


In say cell Z1 of the sheet, enter the formula;

=65534-COUNTIF(A3:A65536,"")


Them in your macro, do the following;

Range("A3:I" & Range ("Z1").value)+2).Select
Selection.Sort Key1:=Range("A3"), Order1:=xlAscending
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
_
DataOption1:=xlSortNormal


I don't think there's a way of counting in VB itself. This is th
method I've always used.

Hope this helps,


Da

--
dspence
-----------------------------------------------------------------------
dspencer's Profile: http://www.excelforum.com/member.php...fo&userid=3096
View this thread: http://www.excelforum.com/showthread.php?threadid=50633

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Sorting

Thanks will give it a go

Greg
"dspencer" wrote in
message ...

In say cell Z1 of the sheet, enter the formula;

=65534-COUNTIF(A3:A65536,"")


Them in your macro, do the following;

Range("A3:I" & Range ("Z1").value)+2).Select
Selection.Sort Key1:=Range("A3"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,
_
DataOption1:=xlSortNormal


I don't think there's a way of counting in VB itself. This is the
method I've always used.

Hope this helps,


Dan


--
dspencer
------------------------------------------------------------------------
dspencer's Profile:
http://www.excelforum.com/member.php...o&userid=30967
View this thread: http://www.excelforum.com/showthread...hreadid=506333



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 Values Without Sorting Formulas SBX Excel Discussion (Misc queries) 2 April 12th 09 11:17 PM
Automatic sorting (giving max and min) based on custom sorting lis Joe Lewis[_2_] Excel Worksheet Functions 4 November 23rd 08 05:12 AM
Sorting VLookup vs Sorting SumProduct Lauren Excel Discussion (Misc queries) 1 August 21st 07 12:19 AM
Sorting: Sorting by the First Character dzuy Excel Discussion (Misc queries) 2 June 22nd 06 08:27 PM
Sorting ListBox results or transposing ListBox values to other cells for sorting Rob[_8_] Excel Programming 1 July 9th 03 04:35 AM


All times are GMT +1. The time now is 11:20 PM.

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

About Us

"It's about Microsoft Excel"