I've adjusted how I export a sheet. I'll attach the code below. I'm trying to then get the area to autofit the columns, but it doesn't seem to be working. Please let me know if you can see something wrong in the coding.
Private Sub CommandButton1_Click()
Dim NewName As String
Dim nm As Name
Dim ws As Worksheet
Dim obj As Shape
Dim sSheet As Object
Dim strname As String
With Application
.ScreenUpdating = False
NewName = InputBox("Please specify the name of the new workbook", "New Copy")
Range("A1:B57").Select
Selection.Copy
Workbooks.Add
ActiveSheet.Paste
Sheets(Array("Sheet2", "Sheet3")).Select
Sheets("Sheet3").Activate
Application.CutCopyMode = False
ActiveWindow.SelectedSheets.Delete
Sheets("Sheet1").Activate
ActiveWindow.Zoom = 70
'Columns("A:B").EntireColumn.AutoFit
ActiveWorkbook.SaveCopyAs ThisWorkbook.Path & "\" & NewName & ".xls"
ActiveWorkbook.Close SaveChanges:=False
.ScreenUpdating = True
End With
End Sub
Bookmarks