@stepdev & @Crack - Your code generates an error for the simple reason below.
Each iteration of the for loop creates a sheet then gives it a name, ml = "act"
This will generate an error after the 1st iteration as a sheet named "act" already exists, after the 1st iteration.
The only way out is to use this : ActiveSheet.Name = ml + iCount
This way each name is unique.
If you plan to use your code elsewhere, I advise you don't hard-code the upper limit of your sheets to 3, in fact I'd completely do away with the for-loop in favor of the ForEach-loop over the sheets collection.
Note: I didn't verify if you 1st need to cast the iCount variable into string before adding to to ml string variable but I do not think it is necessary.
Last edited by Zakalwe; October 31st, 2015 at 07:45 AM..
Reason: Left part out.
|