• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

reversing spreadsheet data

Hi Narayan


I presume you mean this which is what you sent me.

Sub thun()

Public Sub Sort_Entire_Range()

Set Sort_Range = Range("Data_Range")

For Each row_num In Sort_Range.Rows

row_num.Sort Key1:=row_num, Orientation:=xlSortRows

Next

End Sub

End Sub

And then it comes back Compile Error Expected End Sub.

Mike
 
Hi Mike ,


Just remove the following 2 lines ( one is the first one at the top , and the other is the last one at the bottom ) :


Sub thun()


End Sub


Since the Sort_Entire_Range procedure already has its own SUB and END SUB statements , these two additional statements are giving rise to the error.


Narayan
 
Hi Narayan

I have done that and it came back

Run-time error "1004":

Method "Range" of Object"_Global'Failed

And when I went back into it it had highlighted this

Set Sort_Range = Range("Data Range")

So what that means I have not got a clue. Because I know nothing about Macros.

Mike
 
Hi Mike ,


As indicated earlier , have you defined the range "Data_Range" ?


Click on Formulas -> Name Manager -> New


Enter the name Data_Range , and in the Refers To: box , select the entire range of your data ; if your data is from A3 through G377 , select this range. Press OK.


Narayan
 
Hi Narayan


What a man you are that is perfect it did it all in about 10 secs. It just puzzles me why Microsoft cannot include a formula like this in the Excel formulas it makes things so much faster and easier than this trying to do 850 rows one at a time. Once again thanks a million Narayan may you have a great day and a brilliant life.

Mike
 
Back
Top