看板 Visual_Basic 關於我們 聯絡資訊
※ 引述《nosrep (真相)》之銘言: : Hello, : 我想要將 sh1 B(x)-ED(x) 的Range拷貝到 sh2 某一欄, : 不過我 sh2 的位置可能會有offset,所以未必固定是從 B 開始, : 我會透過一個公式算出,差幾個 Column 開始 Copy : 在 VBA要怎麼達到?...還是我只能一個Cell去 Copy ? : Worksheets(sh1).Range("B" & (Row + 2) & ":ED" & (Row + 2)).Copy : Worksheets(sh2).Range("B" & newrow & ":EF" & newrow) : ^^^ =>可能是變數 ^^^ =>也是要跟著變化 只需一行就能做到 Dim LS,LE As String 'LS起始行 LE結束行 Dim rs,RE As Integer 'rs起始列 RE結束列 Worksheets(1).Range(LS + CStr(rs) + ":" + LE + CStr(RE)).Copy Destination:= _ Worksheets(2).Cells(height, L) ex: Worksheets(1).Range("B1:C2").Copy Destination:=Worksheets(2).Cells(2,1) 將第1頁 Range B1~C2 複製到 第1頁的 A2 的 Cell -- 我的P2個板 自然就是美 傾聽‧自然之美 NB_COLSPRING 科技 Σ 冷 泉 港 >生命孕育地,海洋之心 ClubT [風] 有空可以來逛逛^_^ Blog: http://www.wretch.cc/blog/ClubT http://clubtblog.blogspot.com -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.136.54.70