发布网友 发布时间:2022-04-24 08:46
共1个回答
热心网友 时间:2022-06-18 03:59
Sub MalmquistGetData()
Dim Check
Dim i As Integer, j As Integer
Worksheets(ChosenPeriod1).Activate
NInputs = Range("A1").CurrentRegion.Columns.Count
NBenchmarkDMUs = Range("A1").CurrentRegion.Rows.Count
NInputs = NInputs - 1
NBenchmarkDMUs = NBenchmarkDMUs - 1
NOutputs = Range("A1").Offset(0, NInputs + 2).CurrentRegion.Columns.Count
Worksheets(ChosenPeriod2).Activate
NNewDMUs = Range("A1").CurrentRegion.Rows.Count
NNewDMUs = NNewDMUs - 1
NDMUs = NNewDMUs
If NNewDMUs <> NBenchmarkDMUs Then
MsgBox "You have " & NBenchmarkDMUs & " DMUs in " & ChosenPeriod1 & vbCrLf _
& "and " & NNewDMUs & " DMUs in " & ChosenPeriod2 & "." & vbCrLf _
& "Please edit the Sheets.", vbCritical
End
End If
ReDim EffIndex(NDMUs)
ReDim Lambdas(NDMUs, NDMUs)
ReDim InputSlacks(NDMUs, NInputs)
ReDim OutputSlacks(NDMUs, NOutputs)
ReDim InputsTarget(NDMUs, NInputs)
ReDim OutputsTarget(NDMUs, NOutputs)
ReDim DMUName(NDMUs)
ReDim BenchmarkDMUName(NBenchmarkDMUs)
ReDim NewDMUName(NNewDMUs)
ReDim InputName(NInputs)
ReDim InputUsed(NNewDMUs, NInputs)
ReDim OutputName(NOutputs)
ReDim OutputProced(NNewDMUs, NOutputs)
ReDim BInputs(NBenchmarkDMUs, NInputs)
ReDim BOutputs(NBenchmarkDMUs, NOutputs)
ReDim BenchmarkIndex(NNewDMUs)
ReDim TempInputs(NDMUs, NInputs)
ReDim TempOutputs(NDMUs, NOutputs)
ReDim TempDMUName(NDMUs)
ReDim MIndex(4, NDMUs)
ReDim MIndex1(NDMUs)
ReDim MIndex2(NDMUs)
Worksheets(ChosenPeriod1).Activate
With Range("A1")
For i = 1 To NInputs
InputName(i) = .Offset(0, i)
Next
For i = 1 To NOutputs
OutputName(i) = .Offset(0, i + NInputs + 1)
Next
For i = 1 To NBenchmarkDMUs
BenchmarkDMUName(i) = .Offset(i, 0)
For j = 1 To NInputs
BInputs(i, j) = .Offset(i, j)
Check = .Offset(i, j)
If Check < 0 Or Not IsNumeric(Check) Then
MsgBox "Invalid input value is detected at" & vbCrLf _
& j & "" & "th input of DMU" & " " & BenchmarkDMUName(i) & vbCrLf _
& "Please edit the " & ChosenPeriod1 & " Sheet.", vbCritical
.Offset(i, j).Select
End
End If
Next
For j = 1 To NOutputs
BOutputs(i, j) = .Offset(i, j + NInputs + 1)
Check = .Offset(i, j + NInputs + 1)
If Check < 0 Or Not IsNumeric(Check) Then
MsgBox "Invalid output value is detected at" & vbCrLf _
& j & "" & "th output of DMU" & " " & BenchmarkDMUName(i) & vbCrLf _
& "Please edit the " & ChosenPeriod1 & " Sheet.", vbCritical
.Offset(i, j + NInputs + 1).Select
End
End If
Next
Next
End With