Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default how to change cell colour by simply clicking on it

I am taking a computer course and needed to create an activity using
Excel. I put together an activity where Kindergarten students graph
M&M candies according to colour. What I would like to do is allow for
cells to change colour when a child clicks on it with the mouse. (e.g.
for each yellow M&M, the child is to click on cell in graph under the
pic of the yellow M&M. These cells would in turn change to
corresponding colour.)

I would also need to know how to have cell return to original colour
when clicked on twice- in case a mistake is made.

I have an example of what I want to do- see he
http://www.scs.sk.ca/cyber/elem/lear...s/rec_sht.html

Thank you in advance for your help- I am really new at this and
unfortunately can't figure this out on my own.

Jovette

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default how to change cell colour by simply clicking on it

You could try this

put some autoshapes in C3, E3 and G3 as an example and fill colour them
yellow, red, and blue. Name them MMin3, MMin5, MMin7 and then add this code

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "C4:C20,E4:E20,G4:G20"

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

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


click a cell in columns C, E or G and see what happens.

--
HTH

Bob Phillips

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

"lovebunny" wrote in message
oups.com...
I am taking a computer course and needed to create an activity using
Excel. I put together an activity where Kindergarten students graph
M&M candies according to colour. What I would like to do is allow for
cells to change colour when a child clicks on it with the mouse. (e.g.
for each yellow M&M, the child is to click on cell in graph under the
pic of the yellow M&M. These cells would in turn change to
corresponding colour.)

I would also need to know how to have cell return to original colour
when clicked on twice- in case a mistake is made.

I have an example of what I want to do- see he

http://www.scs.sk.ca/cyber/elem/lear...s/rec_sht.html

Thank you in advance for your help- I am really new at this and
unfortunately can't figure this out on my own.

Jovette



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default how to change cell colour by simply clicking on it

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

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default how to change cell colour by simply clicking on it

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



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default how to change cell colour by simply clicking on it

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




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default how to change cell colour by simply clicking on it

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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
insert date Larry Excel Worksheet Functions 28 July 15th 06 02:41 AM
change a cell background colour to my own RGB colour requirements Stephen Doughty Excel Discussion (Misc queries) 4 June 16th 06 01:08 PM
alternating cell colour mohd21uk via OfficeKB.com New Users to Excel 2 May 12th 06 12:17 PM
Conditional Format as a MACRO Gunjani Excel Worksheet Functions 3 March 29th 06 05:22 PM
How to change cell colour, X no days from inserted date in Excel? Bayvon Excel Worksheet Functions 0 October 14th 05 05:17 AM


All times are GMT +1. The time now is 08:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"