简体   繁体   中英

Excel Copy Row of Formulas Down to Dynamic Number of Rows

I've got a row containing various formulas and I wanted to copy the formulas down to a certain range.

Lets say the row of formulas is from A1:T1 and I wanted to copy the formulas down 20 rows.

The intent is if A1 has the formula Sum(U1:Z1) then A10 should have Sum(U10:Z10)

Perhaps not the best example but you get what I'm saying, the VBA equivalent of highlighting a range of cells and dragging down 20 rows.

What i've got is below:

Sub test()
Sheets("Sheet1").Range("A1:T10").Copy Sheets("Sheet1").Range("A20:T20")
End Sub

The code isn't doing what I want, what am I doing wrong?

To close this question: your row numbers are a bit off:

Sheets("Sheet1").Range("A1:T1").Copy Sheets("Sheet1").Range("A1:T20")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM