Sub ocean_cheng()
Dim iStar As Integer
Dim MaxCol As Integer
iStar = 1
MaxCol = ThisWorkbook.ActiveSheet.Range("IV1").End(xlToLeft).Column
For Col_i = 1 To MaxCol
Col1 = ThisWorkbook.ActiveSheet.Cells(1, Col_i).Value
If Col1 <> "" Then
If Col1 <> "" Then
For j = iStar To Col_i
If j = 1 Then
ThisWorkbook.ActiveSheet.Cells(2, j).Value = Col1 / Col_i
Else: This360问答Workbook.ActiveSheet.Cells(2, j).Value = _
(Col1 / (Col_i - iStar + 1)) 胶村美促+ ThisWorkbook.ActiveSheet.Cells(2, j - 1).Value
End If
Next j
iStar = Col_i + 1
End If
End If
Next Col_i
ThisWorkbook.ActiveSheet.Cells(2, j).Value = ThisWorkbook.ActiveSheet.Cells(2, j - 1).Value
End Sub
我只能用VBA写了,如何把代码放到宏里应该知道吧(Alt+F11)