By what definition is a sheet "empty"? Is there a cell that ALWAYS has a value, but if it is blank, then the sheet is empty? Is there a minimum number of rows in a sheet?
let's say: If Cell A1 is empty, then you want to move it to the end. I would loop through the sheets, looking for the cell value and move it if necessary. However: Let's say you move the first sheet. then, what WAS the first sheet, becomes the last, and the SECOND sheet moves to the first position. In the next iteration of the "For" loop, it looks at the SECOND sheet, effectively skipping the sheet that is now in the first position! So, instead, I would start at the LAST sheet, and begin processing to the first. Like: For Sht from sheets.count to 1 step -1 if (sheets(sht).range("A1").value = "") then sheets(sht).move after:=sheets(sheets.count) endif next Sht Paul ----------------------------------------- “Do all the good you can, By all the means you can, In all the ways you can, In all the places you can, At all the times you can, To all the people you can, As long as ever you can.” - John Wesley ----------------------------------------- ________________________________ From: DHAMODHARAN KARTHIKEYAN <deekart...@gmail.com> To: excel-macros@googlegroups.com Sent: Thu, May 16, 2013 10:14:19 AM Subject: $$Excel-Macros$$ IDENTIFY EMPTY SHEETS AND MOVE TO END Dear Friend(s), SUB : IDENTIFY EMPTY SHEETS AND MOVE TO END. I have more than 50 sheets in a file. I may not be aware, where the empty sheets are placed. Hence, I look for the following : 1. Identify the Empty Sheet / Display the Empty Sheet with Msg Box. 2. Then, move all the Empty Sheet(s) to end. Subject to your time, convenience and availability, you may do the needful. With Regards,DK.-- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros?hl=en. For more options, visit https://groups.google.com/groups/opt_out.