EXCEL VBA 根據特定的字串把資料COPY到特定的SHEETS
Sub doWork() '把年加到A欄位 'Worksheets(1).Activate 'For i = 2 To Worksheets(1).UsedRange.Rows.Count ' If Val(Cells(i, 1)) < 2000 Then ' Cells(i, 1) = "'2013/" & Cells(i, 1) ' End If 'Next 'Exit Sub '先把SHEETS刪除 deleteSheets '新增工作表出來 For i = 1 To 15 Worksheets.Add after:=Worksheets("訂單記錄") Next '更改工作表名稱 'MsgBox Sheets.Count For i = 2 To Sheets.Count 'Sheets(i).Name = "AUS" '美國 changeSheetsName (i) Next '把標題COPY到每一個SHEET去 Sheets(1).Select Range("A1", "I1").Copy For i = 2 To Sheets.Count Worksheets(i).Activate Range("A1").Select ActiveSheet.Paste Next '把資料依據客戶代碼放入相應的SHEETS Worksheets(1).Activate 'MsgBox Worksheets(1).UsedRange.Rows.Count For i = 2 To Worksheets(1).UsedRange.Rows.Count Sheets(1).Select Range("A" & i, "I" & i).Copy