Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Alf Alf is offline
external usenet poster
 
Posts: 3
Default Changing cell color

I have bunch of survey questions that ask for answers that rank importance.
Each question is followed by 5 cells in a row and I want to change the color
of one of these cells when someone selects it. Changing the selected cell in
a row would then toggle the old one and change the color of the new one
picked.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Changing cell color

Lets say your questions are in column A and the answers are in cols B thru F.
Put the following macro in the worksheet code area:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim i As Long
If Intersect(Target, Range("B:F")) Is Nothing Then Exit Sub
r = Target.Row
rs = "B" & r & ":F" & r
Range(rs).ClearFormats
Target.Interior.ColorIndex = 6
End Sub

--
Gary''s Student - gsnu200738


"Alf" wrote:

I have bunch of survey questions that ask for answers that rank importance.
Each question is followed by 5 cells in a row and I want to change the color
of one of these cells when someone selects it. Changing the selected cell in
a row would then toggle the old one and change the color of the new one
picked.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Alf Alf is offline
external usenet poster
 
Posts: 3
Default Changing cell color

Well, not only did this work, but you even guessed the correct format of my
sheet columns A-F. Thanks very much and that was very interesting.
Alf

"Gary''s Student" wrote:

Lets say your questions are in column A and the answers are in cols B thru F.
Put the following macro in the worksheet code area:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim i As Long
If Intersect(Target, Range("B:F")) Is Nothing Then Exit Sub
r = Target.Row
rs = "B" & r & ":F" & r
Range(rs).ClearFormats
Target.Interior.ColorIndex = 6
End Sub

--
Gary''s Student - gsnu200738


"Alf" wrote:

I have bunch of survey questions that ask for answers that rank importance.
Each question is followed by 5 cells in a row and I want to change the color
of one of these cells when someone selects it. Changing the selected cell in
a row would then toggle the old one and change the color of the new one
picked.

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
Cell Color Shading Changing bmwcoke Excel Discussion (Misc queries) 0 July 12th 07 01:22 PM
Cell colors or text color changing when date in cell gets closer. Chase Excel Worksheet Functions 5 October 19th 06 08:57 AM
changing cell background color okelbes Excel Worksheet Functions 1 September 20th 06 03:28 PM
Changing the cell color due to results. JGarces Excel Discussion (Misc queries) 2 January 12th 06 06:54 PM
Changing Cell Color GWOOD Excel Worksheet Functions 2 November 10th 05 05:40 PM


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

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

About Us

"It's about Microsoft Excel"