Please Login or Register to view this content.
Please Login or Register to view this content.
Last edited by Cutter; 09-18-2012 at 07:48 PM. Reason: Added code tags
The recorded codes work if I use absolute references to record, but I have to use relative reference since the total records are changing.
@ lans_bazx
Welcome to the forum.
Please notice that code tags have been added to your post(s). The forum rules require them so please keep that in mind and add them yourself whenever showing code in any of your future posts. To see instructions for applying them, click on the Forum Rules button at the top of the page and read Rule #3.
Thanks.
Try this
Please Login or Register to view this content.
Thanks,
Mike
If you are satisfied with the solution(s) provided, please mark your thread as Solved.
Select Thread Tools-> Mark thread as Solved.
Thank you very much Mike and Cutter for your help
but when I add the codes, it still give me debug message
Can you debug these codes for me? Thanks in advance.
Please Login or Register to view this content.
How about this
Please Login or Register to view this content.
Hi Mike,
This time the debug highlighted as these codes:
Please Login or Register to view this content.
Ok give this a try. I took out all the Activecell.select offset stuff
Please Login or Register to view this content.
Hi Mike,
It works this time, but I want to sort the records by the 2nd column which it's column b. Could you please help me change it?
I just started read the vba book, and try the recorder to solve my problem. I have to learn how to use variables.
Just change the Key.
toPlease Login or Register to view this content.
Please Login or Register to view this content.
Hi Mike,
It works So, how do I sort without the last row?
What do you mean?
Add a -1 to the end of this line
Please Login or Register to view this content.
I would sort all the rows but not the last row. that's why I recorded as following:
Please Login or Register to view this content.
I just re-run it, and it's still include the lastrow in sort. that means the last row is not keep in last row instead it's in the middle of the sort.
This will work
Please Login or Register to view this content.
Sorry Mike, it's still include the last row in sort
Can you upload you workbook?
How do i do that?
Please Login or Register to view this content.
At the bottom where you see Go Advanced click that then scroll down to Manage Attachments.
I just learned to attache a fiel
see if this works for you. Its working for me. I did notice that you had SetRange Range("A1:D" & Lastrow) and your data goes to column E
Please Login or Register to view this content.
This time it shows syntax error
What error is it giving? What Line has the error?
Witht the workbook you uploaded and the code in post #23 it runs like it should on my end.
Hi Mike
Thanks for ur help. I can't use Internet on my computer. I am using cell phone to do it now. It s very slow . I will try it again tonight
Hi Mike
Thanks for ur help. I can't use Internet on my computer. I am using cell phone to do it now. It s very slow . I will try it again tonight
I just compared ur latest two posts. The only difference is the range. Don't know why the sort part is in red color which shows syntax error
Here I added the code to your last workbook you uploaded and it works for me.
test.xlsm
Hi Mike,
I just tested the latest codes again.
The sort result shows the last row is another number instead of 599999.
What version of Excel are you running?
Is this with the attatched workbook or are you running this on another workbook?The sort result shows the last row is another number instead of 599999
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks