Sub 巨集1()
'
' 巨集1 巨集
'
'
For i = 1 To 11
n = Right(String(2, "0") & i, 3)
Workbooks.Open Filename:="C:\Users\Min\Downloads\TEMP\TEST_" & n & ".csv"
Range("B1").Select
ActiveCell.FormulaR1C1 = "新欄位名稱1"
Range("D1").Select
ActiveCell.FormulaR1C1 = "新欄位名稱2"
Range("F1").Select
ActiveCell.FormulaR1C1 = "新欄位名稱3"
Range("F2").Select
Cells.Replace What:="=-不分區", Replacement:="000-不分區", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
ChDir "C:\Users\Min\Downloads\TEMP"
ActiveWorkbook.SaveAs Filename:= _
"C:\Users\Min\Downloads\TEMP\TEST_" & n & ".xlsx", FileFormat:= _
xlOpenXMLWorkbook, CreateBackup:=False
Next i
End Sub
沒有留言:
張貼留言