Hi bob!
You right. Its realy tough!
see if this is what you wanted. and try the code below.
coloring.xls |
---|
|
---|
| A | B | C | D |
---|
1 | | | Options | Score |
---|
2 | | PROCUREMENT | | |
---|
3 | 1.1 | Tender??Type | | 20 |
---|
4 | | Bill?of?Quantities | 20 |
---|
5 | | Cost?Plus | 20 |
---|
6 | | Term?Maintenance | 15 |
---|
7 | | Design?&?Build | 15 |
---|
8 | | Bill?of?Quants?with?CDP | 10 |
---|
9 | | Spec?&?Drawings | 10 |
---|
10 | | Management?Fee | 10 |
---|
11 | | Bespoke?contract?/?GMP | 5 |
---|
12 | | Design?&?Build?Novated | 5 |
---|
13 | 1.2 | Procurement?Route | | 20 |
---|
14 | | 0ther | ? |
---|
15 | | 2?stage? | 20 |
---|
16 | | Partnered | 20 |
---|
17 | | Negotiated?(tender?list?1?of?1) | 30 |
---|
18 | | Competitive | 15 |
---|
19 | | PPP | 15 |
---|
20 | | PFI | 15 |
---|
21 | 1.3 | Commercial?Scope | | 0-10 |
---|
22 | | Marked?subjectively;?between?0?and?10 | 0-10 |
---|
23 | | {any?score?over?5?must?set?out?basis?for?score} | |
---|
|
---|
The code!<font face=Courier New><SPAN style="color:#00007F">Private</SPAN><SPAN style="color:#00007F">Sub</SPAN> Worksheet_BeforeDoubleClick(<SPAN style="color:#00007F">ByVal</SPAN> Target<SPAN style="color:#00007F">As</SPAN> Range, Cancel<SPAN style="color:#00007F">As</SPAN><SPAN style="color:#00007F">Boolean</SPAN>)
<SPAN style="color:#00007F">Static</SPAN> LastCell<SPAN style="color:#00007F">As</SPAN> CellX
<SPAN style="color:#00007F">Static</SPAN> Grpcell()<SPAN style="color:#00007F">As</SPAN> CellX
<SPAN style="color:#00007F">Static</SPAN> Initx<SPAN style="color:#00007F">As</SPAN><SPAN style="color:#00007F">Boolean</SPAN>
<SPAN style="color:#00007F">Set</SPAN> isect = Application.Intersect(Target, Range("b:B"))
<SPAN style="color:#00007F">If</SPAN> isect<SPAN style="color:#00007F">Is</SPAN><SPAN style="color:#00007F">Nothing</SPAN><SPAN style="color:#00007F">Then</SPAN><SPAN style="color:#00007F">Exit</SPAN><SPAN style="color:#00007F">Sub</SPAN>
Redimx:
<SPAN style="color:#00007F">If</SPAN><SPAN style="color:#00007F">Not</SPAN> Initx<SPAN style="color:#00007F">Then</SPAN>
<SPAN style="color:#00007F">ReDim</SPAN><SPAN style="color:#00007F">Preserve</SPAN> Grpcell(Application.WorksheetFunction.CountA(Range("a:A")) - 1)<SPAN style="color:#00007F">As</SPAN> CellX
k = 2<SPAN style="color:#007F00">'blank cel in A before the first entry in A</SPAN>
<SPAN style="color:#00007F">For</SPAN> I =<SPAN style="color:#00007F">LBound</SPAN>(Grpcell)<SPAN style="color:#00007F">To</SPAN><SPAN style="color:#00007F">UBound</SPAN>(Grpcell) - 1
<SPAN style="color:#00007F">While</SPAN> Range("A" & k).Value = ""
k = k + 1
<SPAN style="color:#00007F">Wend</SPAN>
st = k
k = k + 1
<SPAN style="color:#00007F">While</SPAN> Range("A" & k).Value = ""
k = k + 1
<SPAN style="color:#00007F">Wend</SPAN>
k = k - 1
en = k
<SPAN style="color:#00007F">Set</SPAN> Grpcell(I).Rng = Range("b" & st & ":b" & en)
<SPAN style="color:#00007F">Next</SPAN> I
<SPAN style="color:#00007F">Set</SPAN> Grpcell(I).Rng = Range("b" & k + 1 & ":b" & Range("b65536").End(xlUp).Row)
Initx =<SPAN style="color:#00007F">True</SPAN>
<SPAN style="color:#00007F">End</SPAN><SPAN style="color:#00007F">If</SPAN>
<SPAN style="color:#00007F">If</SPAN> (Initx) And ((Application.WorksheetFunction.CountA(Range("a:A")) - 1)<><SPAN style="color:#00007F">UBound</SPAN>(Grpcell))<SPAN style="color:#00007F">Then</SPAN>
Initx =<SPAN style="color:#00007F">False</SPAN>
<SPAN style="color:#00007F">ReDim</SPAN> Grpcell(0)<SPAN style="color:#00007F">As</SPAN> CellX
<SPAN style="color:#00007F">GoTo</SPAN> Redimx
<SPAN style="color:#00007F">End</SPAN><SPAN style="color:#00007F">If</SPAN>
<SPAN style="color:#00007F">For</SPAN> I =<SPAN style="color:#00007F">LBound</SPAN>(Grpcell)<SPAN style="color:#00007F">To</SPAN><SPAN style="color:#00007F">UBound</SPAN>(Grpcell)
<SPAN style="color:#00007F">Set</SPAN> isect = Application.Intersect(Grpcell(I).Rng, Target)
<SPAN style="color:#00007F">If</SPAN><SPAN style="color:#00007F">Not</SPAN> isect<SPAN style="color:#00007F">Is</SPAN><SPAN style="color:#00007F">Nothing</SPAN><SPAN style="color:#00007F">Then</SPAN>
<SPAN style="color:#00007F">If</SPAN> Grpcell(I).Target<SPAN style="color:#00007F">Is</SPAN><SPAN style="color:#00007F">Nothing</SPAN><SPAN style="color:#00007F">Then</SPAN>
<SPAN style="color:#00007F">Set</SPAN> Grpcell(I).Target = Target
Grpcell(I).ColorIndex = Target.Interior.ColorIndex
Target.Offset(0, 0).Interior.ColorIndex = 3
Target.Offset(0, 1).Interior.ColorIndex = 3
<SPAN style="color:#00007F">Exit</SPAN><SPAN style="color:#00007F">For</SPAN>
<SPAN style="color:#00007F">Else</SPAN>
Range(Grpcell(I).Target.Address).Interior.ColorIndex = Grpcell(I).ColorIndex
Range(Grpcell(I).Target.Address).Offset(0, 1).Interior.ColorIndex = Grpcell(I).ColorIndex
<SPAN style="color:#00007F">Set</SPAN> Grpcell(I).Target = Target
Grpcell(I).ColorIndex = Target.Interior.ColorIndex
Target.Offset(0, 0).Interior.ColorIndex = 3
Target.Offset(0, 1).Interior.ColorIndex = 3
<SPAN style="color:#00007F">Exit</SPAN><SPAN style="color:#00007F">For</SPAN>
<SPAN style="color:#00007F">End</SPAN><SPAN style="color:#00007F">If</SPAN>
<SPAN style="color:#00007F">End</SPAN><SPAN style="color:#00007F">If</SPAN><SPAN style="color:#00007F">Next</SPAN> I
<SPAN style="color:#00007F">Set</SPAN> MA = Target.Offset(0, 2).MergeArea
<SPAN style="color:#00007F">If</SPAN> MA.Address = Target.Offset(0, 2).Address<SPAN style="color:#00007F">Then</SPAN>
Target.Offset(0, 2).Value = Target.Offset(0, 1).Value
MsgBox ""
<SPAN style="color:#00007F">Else</SPAN>
<SPAN style="color:#00007F">If</SPAN> MA.Cells(1, 1).Value<> Target.Offset(0, 1).Value<SPAN style="color:#00007F">Then</SPAN>
MA.Cells(1, 1).Value = Target.Offset(0, 1).Value
<SPAN style="color:#00007F">End</SPAN><SPAN style="color:#00007F">If</SPAN>
<SPAN style="color:#00007F">End</SPAN><SPAN style="color:#00007F">If</SPAN>
Cancel =<SPAN style="color:#00007F">True</SPAN>
Application.ScreenUpdating =<SPAN style="color:#00007F">True</SPAN><SPAN style="color:#00007F">End</SPAN><SPAN style="color:#00007F">Sub</SPAN></FONT>