試試這個
Option Explicit
Sub Demo()
Dim srcSht As Worksheet, destSht As Worksheet
Dim rowIndex As Long, colIndex As Long
Set srcSht = ThisWorkbook.Sheets("Sheet1") 'change Sheet1 to your source sheet
Set destSht = ThisWorkbook.Sheets("Sheet2") 'change Sheet1 to your output sheet
rowIndex = 1
colIndex = 28 'set col number for Column AB
With srcSht
Do While .Cells(8, colIndex).Value <> "" 'loop through column AB to last column with data in row 8
destSht.Cells(rowIndex, 1) = .Cells(8, colIndex)/.Cells(9, colIndex)
rowIndex = rowIndex + 5 'increment row by 5
colIndex = colIndex + 1 'increment column by 1
Loop
End With
End Sub
所以,你可以* *拖動公式,是嗎?你只是想計算'AB8/AB9',然後'AB9/AB10','AB10/AB11'等?但從表2開始,列A,然後是F,然後是K等? – BruceWayne
我想從表1中複製公式AB8/AB9並將其插入到工作表2中的每第5列中並添加+1列,以便工作表2中的A1看起來像AB8/AB9,並且A5將是AC8/AC9而不是AG8/AG9作爲欄A1-A5填寫sheet2中的另一個數據 – Zenik