我之前尝试过将行引用到列/列到行。它们并不完美,但它们很有效。但是,当它跳跃时我遇到了麻烦,我真的需要帮助。
我的代码没有返回错误,但只有 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