¿Cómo mantener formato en macro que copia hoja en excel?
Tengo la siguiente macro que me copia unas celdas en otra hoja de excel, pero quiero que mantenga el formato (ancho de las columnas, sin líneas de cuadrícula, etc. Pero no sé cuál es la instrucción.
Sub Copia()
Dim hoja As Worksheet, existe As Boolean, nueva As String
nueva = Sheets("Plan de Desarrollo").Range("D8")
If nueva = Empty Then Exit Sub
For Each hoja In Worksheets
If hoja.Name = nueva Then existe = True: _
MsgBox "Ya existe el expediente", vbCritical
Next hoja
If existe = False Then
Sheets.Add After:=Sheets(Sheets.Count)
With ActiveSheet
.Name = nueva
.Tab.Color = 65535
End With
Sheets("Plan de desarrollo").Range("A1:J115").Copy
Sheets(nueva).Range("A1").PasteSpecial _
Paste:=xlPasteAllUsingSourceTheme, Operation:=xlNone _
, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Range("A1:J1").Select
MsgBox "Se Creo Correctamente", vbInformation
Sheets("Plan de Desarrollo").Select
End If
End Sub
Sub Copia()
Dim hoja As Worksheet, existe As Boolean, nueva As String
nueva = Sheets("Plan de Desarrollo").Range("D8")
If nueva = Empty Then Exit Sub
For Each hoja In Worksheets
If hoja.Name = nueva Then existe = True: _
MsgBox "Ya existe el expediente", vbCritical
Next hoja
If existe = False Then
Sheets.Add After:=Sheets(Sheets.Count)
With ActiveSheet
.Name = nueva
.Tab.Color = 65535
End With
Sheets("Plan de desarrollo").Range("A1:J115").Copy
Sheets(nueva).Range("A1").PasteSpecial _
Paste:=xlPasteAllUsingSourceTheme, Operation:=xlNone _
, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Range("A1:J1").Select
MsgBox "Se Creo Correctamente", vbInformation
Sheets("Plan de Desarrollo").Select
End If
End Sub