Conditional Popup message

  • Thread starter Thread starter William Hamilton
  • Start date Start date
W

William Hamilton

I am putting together a spreadsheet that allows a client to enter
ineterview criteria that is weighted etc. Part of this is allowing them
to change the weights (pervcentages). I would like for a popup message
to appear if the percentage goes over 100.

I have roughly put this together

Function ValueCheck(ByVal Target As Range, Maximum As Integer)
If Sum(Target.Column) > Maximum Then
Beep
MsgBox "Caution, 100% has been exceeded!"
End If
End Function

In the cell that shows total percentage I have =ValueCheck(B7:B28,100)

I would like to try make it pretty generic so I can check against other
values later.

As a 2nd, how can I out a variable in the msgBox message ie: instead of
100% just put Maximum.

TIA

W
 
MsgBox "Caution, " + Str(maximum) + " has been exceeded!"
should do the second part
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top