I am new at writing VBA scripts and made the following to filer out some data, copy it to a new workbook and save this one in a specific folder....I am sure there are some beginner mistakes in this code...any suggestions to improve?
Private Sub CommandButton1_Click()
Set NewBook = Workbooks.Add
Dim strCriteria As String
strCriteria = InputBox("Enter MyCollis Username or Leave Empty")
If strCriteria = vbNullString Then
Sheet1.[A1:F15000].Copy
Else
Sheet1.[A1:F15000].AutoFilter Field:=6, Criteria1:=strCriteria
Sheet1.[A1:F15000].Copy
End If
NewBook.Worksheets("Sheet1").Range("B1").PasteSpecial (xlPasteValues)
Selection.NumberFormat = "m/d/yyyy"
ActiveWorkbook.SaveAs Filename:="C:\Users\36976\Desktop\" & "contracts" & "_" & strCriteria & "_" & Str(Format(Now(), "yyyymmdd")) & ".xlsx"
End Sub