Hello Anybody willing to lend a hand?
I have a button that uses the following macro:
'Ensure weights sum to 100% and are placed correctly
msg = ""
toolsCt = WorksheetFunction.CountA(toolsRng)
weightsCt = WorksheetFunction.Count(weightsRng)
Select Case toolsCt - weightsCt
Case 0
If Range("SumOfWeights").Value <> 1 Then
msg = msg & "Weights must sum to 100% - please correct and try again." & vbCrLf & vbCrLf
End If
Case Is > 0
If Range("SumOfWeights").Value <> 1 Then
msg = msg & "Weights must sum to 100% - please correct and try again." & vbCrLf & vbCrLf
End If
msg = msg & "Each Eval Tool must be given a weight - please correct and try again."
Case Is < 0
If Range("SumOfWeights").Value <> 1 Then
msg = msg & "Weights must sum to 100% - please correct and try again." & vbCrLf & vbCrLf
End If
msg = msg & "There must be an Eval Tool for each weight - please correct and try again."
End Select
If msg <> "" Then
Application.Calculation = xlCalculationAutomatic
MsgBox msg
Exit Sub
End If
The above macro is supposed to look at column C and get the information from C8:C17 if the sum adds up to 100%, then the macro will create a number of additional sheets.
My problem is that even though the addition in C18 is 100%, the macro keeps telling me that the "Weight must sum to 100%"
I cannot resolve the problem, and I would like to share my program with my colleagues.
Any help?
I have a button that uses the following macro:
'Ensure weights sum to 100% and are placed correctly
msg = ""
toolsCt = WorksheetFunction.CountA(toolsRng)
weightsCt = WorksheetFunction.Count(weightsRng)
Select Case toolsCt - weightsCt
Case 0
If Range("SumOfWeights").Value <> 1 Then
msg = msg & "Weights must sum to 100% - please correct and try again." & vbCrLf & vbCrLf
End If
Case Is > 0
If Range("SumOfWeights").Value <> 1 Then
msg = msg & "Weights must sum to 100% - please correct and try again." & vbCrLf & vbCrLf
End If
msg = msg & "Each Eval Tool must be given a weight - please correct and try again."
Case Is < 0
If Range("SumOfWeights").Value <> 1 Then
msg = msg & "Weights must sum to 100% - please correct and try again." & vbCrLf & vbCrLf
End If
msg = msg & "There must be an Eval Tool for each weight - please correct and try again."
End Select
If msg <> "" Then
Application.Calculation = xlCalculationAutomatic
MsgBox msg
Exit Sub
End If
The above macro is supposed to look at column C and get the information from C8:C17 if the sum adds up to 100%, then the macro will create a number of additional sheets.
My problem is that even though the addition in C18 is 100%, the macro keeps telling me that the "Weight must sum to 100%"
I cannot resolve the problem, and I would like to share my program with my colleagues.
Any help?