Te sugeriría que reemplaces la macro que tienes por esta otra variante:
Código PHP:
Sub LibrosPorGrupos()
Dim lastCol As Integer, ii As Integer
Dim myPath As String, newName As String, fso As Object
If ThisWorkbook.Path = Empty Then
MsgBox "Debes -primero- guardar este libro..."
End
End If
Application.ScreenUpdating = False
myPath = ThisWorkbook.Path & "\PorGrupos"
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FolderExists(myPath) Then
fso.DeleteFolder (myPath)
End If
fso.CreateFolder myPath
Set fso = Nothing
lastCol = Cells(3, Columns.Count).End(xlToLeft).Column
For ii = 1 To lastCol Step 5
With Worksheets("Nombres").Cells(1, (4 + ii) / 5)
If .Value = "" Then
newName = myPath & "\_SinNombre " & .Column
Else
newName = myPath & "\" & .Value
End If
End With
Range(Cells(1, ii), Cells(Rows.Count, ii).End(xlUp)).Resize(, 4).Copy
Workbooks.Add xlWBATWorksheet
ActiveSheet.Paste
ActiveWorkbook.Close True, newName
Next ii
Application.ScreenUpdating = True
Shell "Explorer " & myPath, vbMaximizedFocus
End Sub
Y ejecútala teniendo la hoja Hoja1 (o como sea que la llames) seleccionada.
¿Te puede servir?...
Saludos, Cacho R.