ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sorting (https://www.excelbanter.com/excel-programming/351797-sorting.html)

Greg B[_7_]

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



Greg B[_7_]

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



dspencer[_3_]

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


Greg B[_7_]

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





All times are GMT +1. The time now is 10:04 AM.

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