2012-05-18 58 views

回答

1

這是否對你的工作:在用戶需要參照細胞,而不僅僅是單元格值係數增加

*。

Sub Row2ColumnReferance() 

Dim rRangeCopy As Range, CRangePaste As Range 
Dim jump As Integer 

'get input 
Set rRangeCopy = Application.InputBox("Select Copy Range", "Transform", Type:=8) 
Set CRangePaste = Application.InputBox("Select Destination Range", "Transform", Type:=8) 
jump = Application.InputBox("Enter") 

Dim cel As Range, intCnt As Integer 

'place new cells 
intCnt = 1 
For Each cel In rRangeCopy 
    CRangePaste.Cells(intCnt, 1).Formula = "=" & cel.Address(False, False) 
    intCnt = intCnt + 1 
Next 

Dim intRows As Integer 

'insert space 
intCnt = CRangePaste.Rows.Count 
For intRows = intCnt To 2 Step -1 
    Range(CRangePaste.Cells(intRows, 1), CRangePaste.Cells(intRows + jump - 1, 1)).Insert shift:=xlDown 
Next 

End Sub 
+0

它的工作原理是兩件小事:1.我想有單元格引用而不是值。所以它只是將C6,C7,C8鏈接到單元格D1(「= C6),D3(」= C7「),D5(=」C8「)假設跳轉爲2。你的幫助 – NCC

+1

看到我的編輯我撿到了這個 –

+0

跳轉不起作用現在它引用一行沒有任何空間的列(即使我輸入10,20,30 ...) – NCC

相關問題