对于实验过的 VBA 开发人员/用户来说,这可能是一段非常简单的代码,但是我是新的编程人员,我已经在这个任务上停留了几天:(。我所需要的只是将一个公式应用于用户定义的范围,或者一个整体(如果可能的话)或用“for-each next”或“for next”循环遍历它,我每次尝试都会出错。有人可以帮我解决这个问题吗....thxs非常提前
假设该公式很简单,例如 F =m*a,即“m”我选择的范围
这里是选择范围的代码:
Option Base 1
Sub KVmodel()
'Select the data points from the excel spreadsheet
Dim A, B As Range
Set A= Application.InputBox("Select A Range", "Select a range", Type:=8)
Set B= Application.InputBox("Select B Range", "Select a range", Type:=8)
'Verify the lenght of the selected data
If A.Count = B.Count Then
MsgBox "Do you want to run the KV Model Adjustment?", vbYesNo
'Calculates F according to the values of the model
-
-
-
Else
MsgBox "The range sizes are different, please re-select the input data"
End If
End Sub