UnleashtheData
New Member
- Joined
- Aug 9, 2016
- Messages
- 8
Hi! Very novice VBA coder here hoping some of you experts can help me out! If I can get this macro, it will be used a lot and save a ton of time!
Basically, I am hoping for a macro that can copy and rename worksheets in bulk, placing the new worksheets starting just after the selected worksheet. Either through an input box or a reference to a range, I hope to be able to enter the desired names for the new worksheets, and to specify which sheet the new sheets should be copied from / modeled after. The number of new worksheet names I enter will vary; I would want the macro to copy and rename the same number of worksheets as the number of names I enter.
For example, say I currently have the following worksheets: "SheetC", "Sheet1", "Sheet2", "Sheet3", "Sheet4", "Sheet5". Say I have "Sheet2" selected when I run the macro, and that I indicate that I want the copies to come from "SheetC". Say I enter the following as the names for the new Worksheets: "SheetA", "SheetB", "SheetC", "SheetD".
Ideally, I would want the result to be as follows: "SheetC", "Sheet1", "Sheet2", "SheetA", "SheetB", "SheetC.1", "SheetD", "Sheet3", "Sheet4", "Sheet5", and each of the new sheets would be copies of the original Sheet C.
(In this example, I asked it to rename a sheet to a name that was already taken. In cases like this, which will happen often, I would love the macro to add a ".1" to the end of the new worksheets name. There will be situations in which this name is also taken, in which case the name would end in ".2". Or ".3" if needed, etc.)
Thank you all so much!!!
Basically, I am hoping for a macro that can copy and rename worksheets in bulk, placing the new worksheets starting just after the selected worksheet. Either through an input box or a reference to a range, I hope to be able to enter the desired names for the new worksheets, and to specify which sheet the new sheets should be copied from / modeled after. The number of new worksheet names I enter will vary; I would want the macro to copy and rename the same number of worksheets as the number of names I enter.
For example, say I currently have the following worksheets: "SheetC", "Sheet1", "Sheet2", "Sheet3", "Sheet4", "Sheet5". Say I have "Sheet2" selected when I run the macro, and that I indicate that I want the copies to come from "SheetC". Say I enter the following as the names for the new Worksheets: "SheetA", "SheetB", "SheetC", "SheetD".
Ideally, I would want the result to be as follows: "SheetC", "Sheet1", "Sheet2", "SheetA", "SheetB", "SheetC.1", "SheetD", "Sheet3", "Sheet4", "Sheet5", and each of the new sheets would be copies of the original Sheet C.
(In this example, I asked it to rename a sheet to a name that was already taken. In cases like this, which will happen often, I would love the macro to add a ".1" to the end of the new worksheets name. There will be situations in which this name is also taken, in which case the name would end in ".2". Or ".3" if needed, etc.)
Thank you all so much!!!