For Each ws In Worksheets
If ws.Name <> "Summary" Then
Sheets("summary").myrange("A2:A30").End(xlUp) = ws.Range("B4:B3").Copy
ActiveSheet.Paste Range("A65536").End(xlUp).Offset(1, 0)
End If
Next ws
End Sub作者: lpk187 時間: 2015-8-2 01:33
試試看
For Each ws In Worksheets
If ws.Name <> "Summary" Then
ws.Range("B4").Copy
aa = Sheets("summary").Range("A65536").End(xlUp).Row + 1
Sheets("summary").Paste Sheets("summary").Range("A" & aa, "A" & aa + 29)
End If
Next ws作者: missbb 時間: 2015-8-2 11:51
我在9樓就有解釋給你了,單一有單一的做法,範圍有範圍的做法,單一不一定能套用在範圍
Sub move()
For Each ws In Worksheets
ll = ws.Name
If ws.Name <> "summary" Then
範圍數量 = ws.Range("B4", ws.Range("B65536").End(xlUp).Address).Count
範圍陣列內容 = ws.Range("B4", ws.Range("B65536").End(xlUp).Address) '使其成為陣列
For Each Rng In 範圍陣列內容
Sheets("summary").Range("A65536").End(xlUp).Offset(1).Resize(30) = Rng
Next
End If
Next
End Sub作者: missbb 時間: 2015-8-2 19:42
Sub ex()
Set d = CreateObject("Scripting.Dictionary")
With Worksheets("attendance report")
For Each a In .Range(.[E4], .[E4].End(xlDown))
d(a.Value) = "" '取得所有不重複分店
Next
F = InputBox("Enter your month")
For Each ky In d.keys
.Range("B4").AutoFilter Field:=4, Criteria1:=ky
If Dir("C:\Users\mariasfy\Desktop\" & ky & "_" & F & ".pdf") <> "" Then Kill "C:\Users\mariasfy\Desktop\" & ky & "_" & F & "201507.pdf" '同名檔案刪除
.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Users\mariasfy\Desktop\" & ky & "_" & F & ".pdf", Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False '另存成PDF檔案
Next
Dim Mail_Object, Mail_Single As Variant
Email_Subject = "門市出勤報告"
Email_Cc = ""
Email_Bcc = ""
Email_Body = "門市出勤報告, 請回覆"
Set Mail_Object = CreateObject("Outlook.Application")
Set Mail_Single = Mail_Object.CreateItem(o)
With Mail_Single
.Subject = Email_Subject
.To = Email_Send_To
.CC = Email_Cc
.BCC = Email_Bcc
.Body = Email_Body
.Attachments.Add ("C:\Users\mariasfy\Desktop\" & ky & "_" & F & ".pdf")
.Display
'.send
End With