View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.misc
lovebunny lovebunny is offline
external usenet poster
 
Posts: 6
Default how to change cell colour by simply clicking on it

OK, I'll try that- I just noticed that I was deleting the colours from
the other cells as well as the ones on the graph.

OK- I tried it and it worked!!!! My first macro!

Regarding my name-
Yeah- it's very French-Canadian! I guess it's a name that grows on ya
after a while... :)

Thanks again, Bob! You're awesome!!
Jovette


Bob Phillips wrote:
Just create a simple macro

Sub ClearCells()
Dim cell As Range

For each cell in
Range("D10:D20,E10:E20,F10:F20,G10:G20,H10:H20,I10 :I20")
cell.Interior.Colorindex = xlColorindexNone
Next cell

End Sub

maybe add a button to the worksheet from the forms toolbar, and assign that
macro to the button.

BTW, that is an unusual name, is it French-Canadian?

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"lovebunny" wrote in message
oups.com...
IT WORKED!!!
Thanks SO very much, Bob! I could have never done this without your
help!!!! I really appreciate the time you've given me.

One last question-
How can I reset the graph and empty the coloured cells quickly so that
another student can use the graph?

Jovette

Bob Phillips wrote:
The way to rename the shapes is to type the new name into the Names box,

not
via the menu. They should also be named in line with the target columns,
that is MMin4, MMin 5, etc.. not 1,2,3,...

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"lovebunny" wrote in message
oups.com...
Okay, that helped!

I created autoshapes and I pasted them behind my candy images (I had
previously found clipart of different coloured M&M candy and pasted
them in each column). I gave them a corrsponding colour and named

them
MMin1, MMin2, MMin3, MMin4, MMin5 and MMin6 (I went to "insert",
"name", then "define" to do this... Is this correct?) I figured out
how to go in the code part. I pasted the formula you gave me but
modified it according to where my autoshapes are. This is what I
typed:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String =
"D10:D20,E10:E20,F10:F20,G10:G20,H10:H20,I10:I 20,"


On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If .Interior.ColorIndex = xlColorIndexNone Then
.Interior.ColorIndex = Me.Shapes("MMin" &
.Column).Fill.ForeColor.SchemeColor - 7
Else
.Interior.ColorIndex = xlColorIndexNone
End If
End With
End If


ws_exit:
Application.EnableEvents = True
End Sub


Now, the cells that I click into change to white. When I click twice,
they say white. What part of the above formula must I change to get
the cells to be the right colours when I click on them once? My

colours
a D column - yellow, E- brown, F- blue, G-green, H-orange, I-red.
Another question:
Is there also a way that I can clear the graph once the students are
done their activity so that they can start over again?

Thanks again for your help!!!

Jovette

Bob Phillips wrote:
Take a look at this file, and see what you can understand, post back
with
any questions

http://cjoint.com/?ikqUfLyAe0

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"lovebunny" wrote in message
ups.com...
Hi Bob-

Thanks for your help with this.

Unfortunately, I'm not really sure where to put this info. Is

there a
way that I can attach my doc so that you can see what I have put
together so far and guide me from there? I am using Excell 2000.

Thanks,
Jovette