Hi All,
I have daily downloads of files in a folder. The file name suffix always changes with an added "(**) some number in those parentheses. See screen show below.
I would typically, manually edit all the downloaded files suffix, to match my subs syntax can recognize the file name. See two subs examples below.
Is there a way to mass Trim the "(4)"? This number would change daily. Alternatively, is there a way to use a wildcard for each download file name like, "1_CLASS_INTL_Daily***"?
Sub CLASS1_INTL()
Dim MyRange As Range
Windows("1_CLASS_INTL_Daily.csv").Activate
With ActiveSheet.UsedRange
Set MyRange = Range(.Cells(2, 1), .Cells(1, 1).Offset(.Rows.Count - 2, .Columns.Count - 1))
MyRange.Select
Selection.Copy
End With
Windows("Calculator for All Class 8.12.2021.xlsm"). _
Activate
Sheets("CLASS 1 - INTL").Select
Range("A2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Windows("1_CLASS_INTL_Daily.csv").Close
End Sub
Sub CLASS2_INTL()
Dim MyRange As Range
Windows("2_CLASS_INTL_Daily.csv").Activate
With ActiveSheet.UsedRange
Set MyRange = Range(.Cells(2, 1), .Cells(1, 1).Offset(.Rows.Count - 2, .Columns.Count - 1))
MyRange.Select
Selection.Copy
End With
Windows("Calculator for All Class 8.12.2021.xlsm"). _
Activate
Sheets("CLASS 2 - INTL").Select
Range("A2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Windows("2_CLASS_INTL_Daily.csv").Close
End Sub
I have daily downloads of files in a folder. The file name suffix always changes with an added "(**) some number in those parentheses. See screen show below.
I would typically, manually edit all the downloaded files suffix, to match my subs syntax can recognize the file name. See two subs examples below.
Is there a way to mass Trim the "(4)"? This number would change daily. Alternatively, is there a way to use a wildcard for each download file name like, "1_CLASS_INTL_Daily***"?
Sub CLASS1_INTL()
Dim MyRange As Range
Windows("1_CLASS_INTL_Daily.csv").Activate
With ActiveSheet.UsedRange
Set MyRange = Range(.Cells(2, 1), .Cells(1, 1).Offset(.Rows.Count - 2, .Columns.Count - 1))
MyRange.Select
Selection.Copy
End With
Windows("Calculator for All Class 8.12.2021.xlsm"). _
Activate
Sheets("CLASS 1 - INTL").Select
Range("A2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Windows("1_CLASS_INTL_Daily.csv").Close
End Sub
Sub CLASS2_INTL()
Dim MyRange As Range
Windows("2_CLASS_INTL_Daily.csv").Activate
With ActiveSheet.UsedRange
Set MyRange = Range(.Cells(2, 1), .Cells(1, 1).Offset(.Rows.Count - 2, .Columns.Count - 1))
MyRange.Select
Selection.Copy
End With
Windows("Calculator for All Class 8.12.2021.xlsm"). _
Activate
Sheets("CLASS 2 - INTL").Select
Range("A2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Windows("2_CLASS_INTL_Daily.csv").Close
End Sub