Hello All,
I'm not entirely sure what is going on. I used the below code successfully, but when I attempted to assign the code to a button on the spreadsheet I received the Run-time error. I'm not entirely sure why the code would suddenly stop working. The code I'm using is below:
The line with Bold codes within my code is where I'm sent to when I click on "Debug", but as I stated before, the code was working just fine, and I didn't make any changes other than trying to assign the code to a form button within the spreadsheet I'm using. Very confused.
D.
I'm not entirely sure what is going on. I used the below code successfully, but when I attempted to assign the code to a button on the spreadsheet I received the Run-time error. I'm not entirely sure why the code would suddenly stop working. The code I'm using is below:
VBA Code:
Sub Beltway()
Dim TableSheet As Worksheet
Dim NewWB As Workbook
Set TableSheet = Worksheets("AllData")
With TableSheet
.ListObjects("Table6").Range.AutoFilter Field:=3, Criteria1:="Beltway"
.ListObjects("Table6").Range.AutoFilter Field:=5, Criteria1:="Open*"
.ListObjects("Table6").Range.AutoFilter Field:=4, Criteria1:=Array("CSC", "SX", "XM; 2.5", "XM; 2.6", "XM; 3", "XR", "XM; 1", "XM; 2", "Mall Kiosk", "XM", "Kiosk", "3.0", "XR Lite", "Legacy Pre-Paid", "Pop Up", "Pop-Up", "PR", "Sat Loc 3351"), Operator:=xlFilterValues
[B] .Range("Table6[[#Headers],[Store Id]]").Select[/B]
.Range(Selection, Selection.End(xlToRight)).Select
.Range(Selection, Selection.End(xlDown)).Select
End With
Selection.Copy
Set NewWB = Workbooks.Add
With NewWB.Worksheets(1)
.Paste
Application.CutCopyMode = False
.Cells.EntireColumn.AutoFit
End With
NewWB.SaveAs Filename:="C:\Users\DVelez202\Desktop\POC Validation-Request\Non-BP Beltway POC Region " & Format(Date, "mm.dd.yyyy") & ".xlsx", _
FileFormat:=xlOpenXMLWorkbook, _
CreateBackup:=False
End Sub
The line with Bold codes within my code is where I'm sent to when I click on "Debug", but as I stated before, the code was working just fine, and I didn't make any changes other than trying to assign the code to a form button within the spreadsheet I'm using. Very confused.
D.