>即時新聞-熱門

2010年8月19日星期四

合併

Sub 合併工作表()
mydate = Now()
If Month(Now()) < 10 Then
mydate1 = "0" & Month(Now())
newname = Year(mydate) & mydate1 & Day(mydate)
Else
newname = Year(mydate) & Month(mydate) & Day(mydate)
End If


y = InputBox("請輸入合併工作表數量", "世新")

For x = 1 To y

Sheets(x + 1).Select
If x = 1 Then

Range("A1").Select
Else
Range("A2").Select

End If
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Copy
Sheets(1).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
Next
Range("A1").Select
Sheets(1).Name = newname
End Sub

0 评论:

 
妹咕數位學園歡迎網友們來信指教 妹咕信箱