VBA Excel Sheets with similar names to new workbook
I need to copy sheets with similar names to a new workbook. So if there are sheets
SHeetA
SheetA (1)
SheetA (2)
Would all copy Range A1:C34 to the new sheet starting at A1 and shifting based on the number of sheets it copies. So the Values of SheetA (1) would be pasted starting at E1 skipping one column.
You could also have just a single sheet
SheetB
Which would just be copied to a new workbook. Coping range A1:C34 to the new workbook and pasting it to A1.
Thanks,
Montrof
Microsoft ExcelVBA
Last Comment
gowflow
8/22/2022 - Mon
Norie
Do you know the (partial) names of the sheets you want to copy from?
For example 'SheetA'.
gowflow
What if in a workbook you have
Sheet1
Sheet1 A
Sheet2
Sheet3
SheetA
SheetA (1)
SheetA (2)
It is clear for SheetA but what about Sheet2, Sheet3 ?? are they ignored ?
and for Sheet1 who also have a similar sheet Sheet1 A do we save it in same workbook as SheetA or a new one ??
Best is to post a sample workbook.
gowflow
and if
montrof
ASKER
So in your example above all sheets would end in (#) so SheetA SheetA (1) and SheetA (2) would all be copied to a new workbook and Saved. The other sheets would each go to an individual new workbook. So all the sheets that have multiple sheets with the same name would end in (#).
For example 'SheetA'.