我正在尝试计算Sheet1和Sheet2中特定列的某些值。问题是Sub下面的Sub首先正确计算Sheet1中矩阵的数字。它将矩阵放在Sheet1的某些单元格中。然后代码用Sheet2中的数字重写该矩阵。但我想将Sheet2的计算放在Sheet2上,而不是Sheet1。关于我做错了什么的任何想法?最诚挚的问候!
Sub Try()
Dim LastRow As Long
Dim LastOne As Long
Dim Sheetz As Variant
Sheetz = Array("Sheet1", "Sheet2")
For h = LBound(Sheetz) To UBound(Sheetz)
With Worksheets(Sheetz(h))
numbers = Array(1, 2, 3)
For j = LBound(numbers) To UBound(numbers)
For i = 1 To 3
LastRow = .Cells(.Rows.Count, i).End(xlUp).Row
LastValue = .Cells(.Rows.Count, i).End(xlUp).Value
FirstOne = .Cells(LastRow - j, i).Value
Cells(i + 1, j + 5) = LastValue / FirstOne - 1
Next i
Next j
End With
Next h
End Sub