粘贴EXCEL中的表格时坐标如何用变量?
例如想将EXCEL中A1:I17范围中的内容复制到同一页的A20:I36中,其中20和36是不固定的,如何实现?
程序代码:
Sub test1() Dim rng As Range, rng2 As Range Dim startRow As Integer, endRow As Integer startRow = 9: endRow = 13 Set rng = ActiveSheet.Range("A" & 1, "D" & 5) Set rng2 = ActiveSheet.Range("A" & startRow, "D" & endRow) rng2.Value = rng.Value End Sub