Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default On click, copy cell contents to another sheet?

Hi,

Sheet1 has cells c3, c4, c5, c6, c7 which contain the colors:

Blue
Red
Green
White
Pink

When the user clicks on a color, I would like to:
a. Copy that color to cell G9 in Sheet3
b. Take the user to Sheet2

How do I do that in VBA code?

Thanks,
Luther



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 176
Default On click, copy cell contents to another sheet?

Luther,

You can use the worksheet selection change event, code below.
Right-click on sheet1's tab, select view code, and paste the code into
the window that appears.

From your post, it was unclear if you had the colors as fill colors or
the words as values. If you have just words, delete the .ColorIndex
line, if fill colors, delete the .Value line.

HTH,
Bernie

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count < 1 Then Exit Sub
If Not Intersect(Target, Range("C3:C7")) Is Nothing Then
Worksheets("Sheet3").Range("G9").Value = Target.Value
Worksheets("Sheet3").Range("G9").Interior.ColorInd ex = _
Target.Interior.ColorIndex
Worksheets("Sheet2").Activate
End If
End Sub

"lothario" wrote in message
...
Hi,

Sheet1 has cells c3, c4, c5, c6, c7 which contain the colors:

Blue
Red
Green
White
Pink

When the user clicks on a color, I would like to:
a. Copy that color to cell G9 in Sheet3
b. Take the user to Sheet2

How do I do that in VBA code?

Thanks,
Luther



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from

http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default On click, copy cell contents to another sheet?

Thanks Bernie. This did help.

I should have been more specific.
I intend to use the words as values.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

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
When I double click a cell, its contents are erased. Maro Excel Discussion (Misc queries) 2 February 19th 09 07:53 PM
Click on cell to increment contents by 1 Swampy Mike Excel Discussion (Misc queries) 3 June 19th 08 03:15 AM
Copy contents to another sheet Richard Excel Worksheet Functions 4 March 5th 08 12:37 PM
VBA code to copy cell contents from one sheet to another Gimp Excel Worksheet Functions 0 February 23rd 07 05:18 PM
cell contents revert to 0 when i click on the next cell su1 New Users to Excel 2 April 28th 05 09:53 PM


All times are GMT +1. The time now is 01:17 PM.

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"