Crear hojas desde una plantilla
Con la siguiente macro creo hojas y las nombra de acuerdo a un listado de acuerdo a un rango determinado, B8:B35. Me gustaría que esas hojas nuevas estén basadas en una plantilla, la hoja es llamada "Master", esta plantilla tiene formulas y celdas con formato.
Sub AddSheets() 'Updateby Extendoffice Dim xRg As Excel.Range Dim wSh As Excel.Worksheet Dim wBk As Excel.Workbook Set wSh = ActiveSheet Set wBk = ActiveWorkbook Application.ScreenUpdating = False For Each xRg In wSh.Range("B8:B35") With wBk .Sheets.Add after:=.Sheets(.Sheets.Count) On Error Resume Next ActiveSheet.Name = xRg.Value If Err.Number = 1004 Then Debug.Print xRg.Value & " already used as a sheet name" End If On Error GoTo 0 End With Next xRg Application.ScreenUpdating = True End Sub
1 respuesta
Respuesta de Dante Amor
1