選擇某範圍,如何求得offset 的值?
例如 A1:B2 即A1 移到 B2 則答案為 OFFSET(1,1)
Sub t()
Dim rng As Range
Set rng = Selection
???= rng.Address
End Sub作者: GBKEE 時間: 2014-8-24 10:19
Sub test() '請用mouse先選擇複製的範圍
Dim rng As Range, a, z, r, rr
Set rng = Selection
z = InputBox("輸入開始位址")
Set r = Range(z).Offset(rng.Rows.Count - 1, rng.Columns.Count - 1)
Set rr = Range(z)
ActiveSheet.Range(rr.Address, r.Address) = Selection.Formula
End Sub作者: GBKEE 時間: 2014-8-25 05:53
Sub test() '請用mouse先選擇複製的範圍
Dim rng As Range, a, z, r, rr
Set rng = Selection '這必是ActiveSheet的Selection
z = InputBox("輸入開始位址")
Set r = Range(z).Offset(rng.Rows.Count - 1, rng.Columns.Count - 1)
Set rr = Range(z)
'ActiveSheet.Range(rr.Address, r.Address) = Selection.Formula '所以這不是複製到不同的工作表的
Sheets("TEST").Range(rr.Address, r.Address) = Selection.Formula '是這樣嗎?
End Sub作者: t8899 時間: 2014-8-25 05:59
回復 t8899
Sub test() '請用mouse先選擇複製的範圍
Dim rng As Range, a, z, r, rr
Set rn ...
GBKEE 發表於 2014-8-25 05:53