我正在尝试运行Weibull模型进行纵向测量。 Weibull具有时间依赖性的结果。我在library(“ eha”)R中找到了以下函数。我不确定是否可以向这些函数添加Sub copy_formulas()
Dim formula As String
Dim rg As Range, rg_row As Integer, rg_column As Integer
Dim cl As Range
Dim col As New Collection, i As Integer
Dim arr As Variant
Dim output As Range
Set rg = Selection
rg_row = rg.Rows.Count
rg_column = rg.Columns.Count
For Each cl In rg
If cl.Value = "" Then
formula = ""
Else
formula = cl.FormulaLocal
End If
col.Add formula
Next
ReDim arr(1 To col.Count)
For i = 1 To col.Count
arr(i) = col.Item(i)
Next i
Set output = Application.InputBox("Select Range", "Range for pasting formulas", Type:=8)
output.Resize(rg_row, rg_column).Select
output.FormulaLocal = arr
End Sub
?如果答案是否定的,那么我该如何拟合模型?这些功能之间有什么区别?
Sub copy_formulas()
Dim formula As String
Dim rg As Range, rg_row As Integer, rg_column As Integer
Dim cl As Range
Dim col As New Collection, i As Integer, y As Integer
Dim arr() As Variant
Dim output As Range
Set rg = Selection
rg_row = rg.Rows.Count
rg_column = rg.Columns.Count
For Each cl In rg
If cl.Value = "" Then
formula = ""
Else
formula = cl.FormulaLocal
End If
col.Add formula
Next
ReDim arr(1 To rg_row, 1 To rg_column)
For i = 1 To rg_row
For y = 1 To rg_column
arr(i, y) = col.Item(((i - 1) * rg_column) + y)
Next y
Next i
Set output = Application.InputBox("Select Range", "Range for pasting formulas", Type:=8)
output.Resize(rg_row, rg_column).FormulaLocal = arr
End Sub