Excel - Pedro F. Pardo escribi?

Asked By titopose on 28-Jun-12 12:15 PM
Pedro F. Pardo escribi? el 28/06/2012 15:04 :
no
Hola Pedro, gracias por responder.
No me di ma?a para integrar el c?digo a mi macro.
Este es el c?digo existente:

If ActiveSheet.Name = "RESU" Then
If MsgBox("CREA ARCHIVO APARTE?" & vbCr & _
289, _
On Error GoTo sinGuardar
Columns("H:M").Select
Application.CutCopyMode = False
Selection.Copy
Workbooks.Add
nbre = InputBox("NOMBRE PARA EL ARCHIVO?")
If nbre = "" Then Exit Sub
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
ActiveWorkbook.SaveAs ThisWorkbook.Path & "" & nbre &

Exit Sub
sinGuardar:
MsgBox "El nombre ya existe"
End If

Ya prob? varias veces y siempre me da un error.
Apelo a tu generosidad.
Agradecido
Tito Pose


Pedro F. Pardo replied to titopose on 28-Jun-12 12:54 PM
Prueba a ver si este c=F3digo funciona...



If ActiveSheet.Name =3D "RESU" Then
If MsgBox("CREA ARCHIVO APARTE?" & vbCr & _
289, _
=20
Columns("H:M").Select
Application.CutCopyMode =3D False
Selection.Copy
Workbooks.Add
Selection.PasteSpecial Paste:=3DxlPasteValues, Operation:=3DxlNone, Ski=
pBlanks:=3DFalse, Transpose:=3DFalse

pregunta:
nbre =3D InputBox("NOMBRE PARA EL ARCHIVO?")
If nbre =3D "" Then Exit Sub
If Dir(ThisWorkbook.Path & "" & nbre & ".xls") <> "" Then
MsgBox ("Ya existe un fichero con ese nombre, Por favor escriba otr=
o nombre")
GoTo pregunta
Else
ActiveWorkbook.SaveAs ThisWorkbook.Path & "" & nbre & ".xls"
End If
End If
=20
Exit Sub