- 帖子
- 4901
- 主題
- 44
- 精華
- 24
- 積分
- 4916
- 點名
- 118
- 作業系統
- Windows 7
- 軟體版本
- Office 20xx
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台北
- 註冊時間
- 2010-4-30
- 最後登錄
- 2025-5-15
               
|
4#
發表於 2012-5-4 21:27
| 只看該作者
回復 3# sax868
確實無法了解你的需求
執行以下程序,自動生成新工作表,得到Updated Data的資料
再來討論你的第2個問題- Sub Ex()
- Dim Sh As Worksheet, Ar()
- For Each Sh In Sheets
- With Sh
- If UBound(Filter(Array("Currency", "DATA", "Updated Data"), .Name, True)) < 0 Then
- ReDim Preserve Ar(57, x)
- If IsEmpty(Ar(0, 0)) Then
- Ar(0, x) = .[B1].Value: Ar(1, x) = .[B2].Value: Ar(2, x) = .[D1].Value
- s = 3
- For Each a In .[A11:BB11].Value
- Ar(s, x) = a
- s = s + 1
- Next
- x = x + 1
- End If
- r = 12
- Do Until .Cells(r, 1) = ""
- ReDim Preserve Ar(57, x)
- Ar(0, x) = .[C1].Value: Ar(1, x) = .[C2].Value: Ar(2, x) = .[E1].Value
- s = 3
- For Each a In .Range(.Cells(r, "A"), .Cells(r, "BB")).Value
- Ar(s, x) = a
- s = s + 1
- Next
- x = x + 1: r = r + 1
- Loop
-
- End If
- End With
- Next
- With Sheets.Add(after:=Sheets(Sheets.Count))
- .[A1].Resize(x, 57) = Application.Transpose(Ar)
- End With
- End Sub
複製代碼 |
|