Need the Uncoloured Cells after double click to be listed in Sheet 2

dorcar90

New Member
Joined
Mar 29, 2012
Messages
4
After doing the following to make cells coloured after double clicking them:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

If Target.Interior.ColorIndex = xlNone Then

' Then change the background color to red
Target.Interior.ColorIndex = 8

' Else if the cell background color is red
ElseIf Target.Interior.ColorIndex = 8 Then

' Then clear the background
Target.Interior.ColorIndex = xlNone

End If

' This is to prevent the cell from being edited when double-clicked
Cancel = True

End Sub

...now I've been stucked of how am I going to do those numbers who are still uncoloured (Range A3:P23) (not double clicked..meaning missing for me) to be added in a list in Sheet 2 column A3 down..
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hi,

FWIW, for the double-click, you might wish to limit its execution to the range of interest, something like:

<font face=Courier New><SPAN style="color:#00007F">Option</SPAN> <SPAN style="color:#00007F">Explicit</SPAN><br>    <br><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>)<br>    <br>    <SPAN style="color:#00007F">If</SPAN> Target.Count = 1 And <SPAN style="color:#00007F">Not</SPAN> Application.Intersect(Me.Range("A1:P23"), Target) <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN> <SPAN style="color:#00007F">Then</SPAN><br>        Cancel = <SPAN style="color:#00007F">True</SPAN><br>        <SPAN style="color:#00007F">If</SPAN> Target.Interior.ColorIndex = xlNone <SPAN style="color:#00007F">Then</SPAN><br>            Target.Interior.ColorIndex = 8<br>        <SPAN style="color:#00007F">ElseIf</SPAN> Target.Interior.ColorIndex = 8 <SPAN style="color:#00007F">Then</SPAN><br>            Target.Interior.ColorIndex = xlNone<br>        <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br>    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>

For plunking the uncolored cell vaalues in another sheet, maybe like:

In a Standard Module:
<font face=Courier New><SPAN style="color:#00007F">Option</SPAN> <SPAN style="color:#00007F">Explicit</SPAN><br>    <br><SPAN style="color:#007F00">'now I've been stucked of how am I going to do those numbers who are still uncoloured</SPAN><br><SPAN style="color:#007F00">'(Range A3:P23) (not double clicked..meaning missing for me) to be added in a list in</SPAN><br><SPAN style="color:#007F00">'Sheet 2 column A3 down..</SPAN><br>    <br><SPAN style="color:#00007F">Sub</SPAN> example()<br><SPAN style="color:#00007F">Dim</SPAN> rngColored                  <SPAN style="color:#00007F">As</SPAN> Range<br><SPAN style="color:#00007F">Dim</SPAN> Cell                        <SPAN style="color:#00007F">As</SPAN> Range<br><SPAN style="color:#00007F">Dim</SPAN> aryColored()                <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Variant</SPAN><br><SPAN style="color:#00007F">Dim</SPAN> aryOutput(1 <SPAN style="color:#00007F">To</SPAN> 336, 1 <SPAN style="color:#00007F">To</SPAN> 1) <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Variant</SPAN><br><SPAN style="color:#00007F">Dim</SPAN> x                           <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN><br><SPAN style="color:#00007F">Dim</SPAN> y                           <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN><br><SPAN style="color:#00007F">Dim</SPAN> lCounter                    <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN><br>    <br>    <SPAN style="color:#00007F">Set</SPAN> rngColored = Sheet1.Range("A3:P23")<br>    aryColored = rngColored.Value<br>    <br>    <SPAN style="color:#00007F">For</SPAN> <SPAN style="color:#00007F">Each</SPAN> Cell <SPAN style="color:#00007F">In</SPAN> rngColored.Cells<br>        <SPAN style="color:#00007F">If</SPAN> Cell.Interior.ColorIndex = 8 <SPAN style="color:#00007F">Then</SPAN><br>            aryColored(Cell.Row - 2, Cell.Column) = vbNullString<br>        <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br>    <SPAN style="color:#00007F">Next</SPAN><br>    <br>    lCounter = 0<br>    <SPAN style="color:#00007F">For</SPAN> x = 1 <SPAN style="color:#00007F">To</SPAN> 21<br>        <SPAN style="color:#00007F">For</SPAN> y = 1 <SPAN style="color:#00007F">To</SPAN> 16<br>            <SPAN style="color:#00007F">If</SPAN> <SPAN style="color:#00007F">Not</SPAN> aryColored(x, y) = vbNullString <SPAN style="color:#00007F">Then</SPAN><br>                lCounter = lCounter + 1<br>                aryOutput(lCounter, 1) = aryColored(x, y)<br>            <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br>        <SPAN style="color:#00007F">Next</SPAN><br>    <SPAN style="color:#00007F">Next</SPAN><br>    Sheet2.Range("A3").Resize(336).Value = aryOutput<br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>

Please note the 'Sheet1' and 'Sheet2' represent CodeNames of the sheets.

Hope that helps,

Mark
 
Upvote 0
The first part of the colour worked..

but in Sheet 2 I am still not shown any numbers (just the value) that I have not double clicked to colour them..

..can I make a system where in sheet 2 I enter the same numbers in the same cells so that those that I colour will remove the number in Sheet 2..so that those that I do not colour will remain in Sheet 2..?

I am making this system to ease missing invoices...those that are not coloured means missing as I have not ticked them..
 
Upvote 0
Numbers are just for my info (as every invoice has its own registered number) .. its not a number to calculate a sum..its just like text..
 
Upvote 0
I am afraid I am still not grasping. You want the values (whether text or numerical) from the cells with no color - correct?

With this:

Excel 2000
ABCDEFGHIJKLMNOP
3813611137TEXT93147659912341107314568
472502221126712279701141104787143643
536647643638328119304311988381019186
63218891124412076642859736846323121
783767783496690378685677940111579
87010011648791146396438119946103612
97115981097841211547102811451311047
10325794401099325820202685233213
117103917045634611555278033910860119
1211426711074540419649875261198411441
1398505547113149743120526944711197475
148737584810045854810520378252119241
15471153416973966742249269124733115
161065521926539158211977828132128388
1786364477108231758115845116618391109
1873809510110219688731031132931092237
199842535832811482863045991075480
2010093103610290104791038489751181058231
21661210689805589485229910412090122
22111469612035116106101369541001186620
2311063141296516716115461181207366312
Sheet1


I get this (on Sheet2):

Excel 2000
A
381
436
537
6TEXT
747
899
9123
1041
11107
12110
1363
1416
15115
1646
17118
18120
1973
2066
2131
222
Sheet2


Is that not what we are after?

Sorry I am not understanding the goal so far. Don't give up, I'm sure it (whatever "it" is at the moment) can be done :)

Mark
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,551
Members
449,088
Latest member
davidcom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top