- 帖子
- 4901
- 主題
- 44
- 精華
- 24
- 積分
- 4916
- 點名
- 142
- 作業系統
- Windows 7
- 軟體版本
- Office 20xx
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台北
- 註冊時間
- 2010-4-30
- 最後登錄
- 2026-7-16
                
|
2#
發表於 2011-8-27 10:33
| 只看該作者
- Private Sub CommandButton1_Click()
- Dim ay()
- With Sheets("訂單")
- r = ActiveCell.Row
- a = .Range(.Cells(r, "B"), .Cells(r, "D")).Value
- b = .Range(.Cells(r, "U"), .Cells(r, "W")).Value
- x = .Cells(r, "S")
- y = .Cells(r, "T")
- For Each c In .Range(.Cells(r, "G"), .Cells(r, "O")).SpecialCells(xlCellTypeConstants, 1)
- k = c.Column
- ar = Array(.Cells(3, k), "", c, Val(.Cells(2, k)), c * 20, Val(.Cells(2, k)) * c * 20)
- ReDim Preserve ay(s)
- ay(s) = ar
- s = s + 1
- Next
- End With
- With Sheets("出貨單")
- .[B9:G17] = ""
- .[C4].Resize(3, 1) = Application.Transpose(a)
- .[F4].Resize(3, 1) = Application.Transpose(b)
- .[B9].Resize(s, 6) = Application.Transpose(Application.Transpose(ay))
- .[G19] = x
- .[G21] = y
- .Select
- End With
- End Sub
複製代碼 回復 1# jesscc |
|