Filename error in VBA

5 pts.
Tags:
Microsoft Excel
VBA
I created a macro to run with my daily reports in Excel. The only issue is the names of the report change every day respectively as Mat1 mm-dd-yy. I have tried to maneuver with the code but it always leads to a dead end. How can I change the code to be able to run with any date?       Mat1Macro Macro '   ' Columns("A:A").Select Selection.Delete Shift:=xlToLeft Rows("1:4").Select Range("A4").Activate Selection.Delete Shift:=xlUp Range("C1").Select Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select Selection.EntireColumn.Delete Cells.Select Cells.EntireColumn.AutoFit Columns("A:B").Select Application.DeleteCustomList ListNum:=5 Application.AddCustomList ListArray:=Array("Smallest to Largest") ActiveWorkbook.Worksheets("Mat1 07-08-13").Sort.SortFields.Clear ActiveWorkbook.Worksheets("Mat1 07-08-13").Sort.SortFields.Add Key:=Range( _ "B2:B715"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _ xlSortNormal   ActiveWorkbook.Worksheets("Mat1 07-08-13").Sort.SortFields.Add Key:=Range( _ "A2:A715"), SortOn:=xlSortOnValues, Order:=xlAscending, CustomOrder:= _       "Smallest to Largest", DataOption:=xlSortNormal With ActiveWorkbook.Worksheets("Mat1 07-08-13").Sort .SetRange Range("A1:B715") .Header = xlYes .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With

Software/Hardware used:
Excel 2007

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following