Hi
Took a bit to clean it up but here you go
http://www.ghost-watch.co.
Thanks for looking at this
Deb :))
Main Topics
Browse All TopicsHi
I don't know if there's a way around this but I lack the math and vba skill to sort it out.
Basically, the chart in a worksheet (it's not really a chart - it just looks a bit like one) looks like this
http://www.ghost-watch.co.
As you can see - with the help of a couple of experts from here I've got a button that run a macro that checks the values of probability and impact (the multiplication of which = gross risk) and puts the corresponding risk code for that row in the correct cell in the chart. This code works a treat, and is as follows:
Sub EnterRiskD()
Dim O As Range
Dim cell As Range
Dim P As Range
Dim I As Range
Dim R As Range
Range("ResultsD").ClearCon
For Each cell In Range("PTableD")
Set P = cell
Set I = cell.Offset(0, 1)
Set R = cell.Offset(0, -2)
If P.Value <> "" And I.Value <> "" Then
Set O = Range("ResultsD").Cells(1,
If O.Value = "" Then
O.Value = R.Value
Else
O.Value = O.Value & "," & R.Value
End If
End If
Next cell
End Sub
The range ResultsD is all the cells that comprise the coloured chart at the top ie from C5 over to H10. The range PTableD is from E16 down - ie more cells than I'll need.
I've now been asked to actually chart the net risk intead - given that when charting say a row that's
Risk Code - 10
Probability - 6
Impact - 6
Gross Risk - 36
Net Risk - 20
My code will happily put Risk Code 10 -in cell H5, when it would need to go in E5 - which is the only cell with impact value of 6 that could hold a value of 20. The number of management controls is 16.
The relationship between Gross Risk and Net Risk is down to the number of management controls in place which arent listed here but this could be any number between 1 and 36. The number of management controls is subtracted from gross risk to produce a value for net risk.
If you understand this so far then thanks for sticking with me. Can any of you maths&vba geniuses come up with a way of charting net risk using a macro and command button? I'm completely stumped. I've awarded the maximum but would quite happily award 20,000 points if I could. Please ask anything you need to know,
Thanks
Deb :))
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hi
Took a bit to clean it up but here you go
http://www.ghost-watch.co.
Thanks for looking at this
Deb :))
There's the rub - actually formulating it - I can't figure out a mathematical relationship for what I've been asked to do - and was wondering if anyone else can, or if indeed one exists that we can use in vba code to plot these values.
A net risk of 20 means that in terms of what we're doing our probability has reduced - but the impact stays the same as we've got five measures in place. (not my idea to calculate it this way)
So if the original values were
x (probability) = 6
y (impact) = 6
Then our gross risk is 36 (x*y). But we've been busy and have got 14 management controls in place and my boss wants this to drop the gross risk by 14. So, we've now got a value of 20. If impact (ie the way it affects us if this risk happens stays the same) then because we've got controls in place the probability of the risk happens reduces.
So which box does a value of 20 go into if impact stays at value 6? Well E5 would hold the value of 20 as it's range of value for y=6 is 18-23 as F5's min value at y=6 is 24. The value of probability at this point flies out of the window (I'm really not sure that it should).
I guess this only partially goes in this TA - Hope this explains a bit better. I'm off to go look at this risk model myself.
That's pretty much what I thought - I think this does what you just described (you might be better off with an actual XY scatter plot though!):
Sub EnterRiskF()
Dim O As Range
Dim cell As Range
Dim lngProb As Long, lngImpact As Long, lngRiskNo As Long, lngNetRisk As Long
Range("ResultsF").ClearCon
For Each cell In Range("PTableF")
lngProb = cell.Value
lngImpact = cell.Offset(0, 1).Value
lngRiskNo = cell.Offset(0, -2).Value
lngNetRisk = cell.Offset(0, 3).Value
If lngProb <> 0 And lngImpact <> 0 Then
Set O = Range("ResultsF").Cells(1,
If O.Value = "" Then
O.Value = lngRiskNo
Else
O.Value = O.Value & "," & lngRiskNo
End If
End If
Next cell
End Sub
HTH
Rory
Hi rorya
Thanks for that - it does work but doesn't quite - but the logic we're trying to apply to this doesn't really work either as the value of probability in terms of the plot doesn't always change if you just then take the net risk and try to figure out where it should go!
Have now asked my boss to come up with a formula that works consistently!
Could you explain to me how you came up with that formula and what your logic is?
ie this bit - Set O = Range("ResultsF").Cells(1,
The rest I understand.
(I've spent so long looking at this database and spreadsheet now my brain's packed in and gone home)
Thanks so much
Deb :))
The key bit is that you take the net risk number and divide it by the Impact, but using integer division (hence the use of \ rather than / ) so it returns the highest whole number of times that Impact goes into Net Risk. The rest is the same as your original code in that it then offsets from the top left cell of the "graph".
Regards,
Rory
Business Accounts
Answer for Membership
by: patrickabPosted on 2006-09-22 at 04:53:29ID: 17576820
Deb,
Could you post a link to your actual file (cleaned of sensitive data of course).
Thanks
Patrick