Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Copy Data on click event

tI have a need to click on a cell containing a text string then have the
string copied to another cell and a 2nd cell set to a different value.

I have a table of string values. I want to click on any cell in the 1 st
column and have the cell content copied to a single fixed location cell. Then
I want a string constant set in a different cell. For the remaining columns
in the table the action is the same except that the constant string set in
the 2nd target cell is different.

How do I do this?
--
Ken Broten
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,090
Default Copy Data on click event

Ken
Something like this perhaps. I assumed the cell that gets the selected cell
contents is A1 and the cell that gets the string constant is B1. I also
assumed your table went from A2 to H100. Change these as needed. Be aware
that this macro will do its thing if you click on any cell in that range.
This macro is a sheet event macro and must be placed in the sheet module for
that sheet you want this to work in. To access that module, right-click on
the sheet tab and select View Code. Paste this macro into that module. "X"
out of the module to return to your sheet. Otto
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim StrConst As String
If Target.Count 1 Then Exit Sub
If Not Intersect(Target, Range("A2:H100")) Is Nothing Then
Range("A1").Value = Target.Value
Select Case Target.Column
Case 1: StrConst = "Whatever One"
Case 2: StrConst = "Whatever Two"
Case 3: StrConst = "Whatever Three"
Case 4: StrConst = "Whatever Four"
Case 5: StrConst = "Whatever Five"
Case 6: StrConst = "Whatever Six"
Case 7: StrConst = "Whatever Seven"
Case 8: StrConst = "Whatever Eight"
End Select
Range("B1").Value = StrConst
End If
End Sub
"Ken Broten" wrote in message
...
tI have a need to click on a cell containing a text string then have the
string copied to another cell and a 2nd cell set to a different value.

I have a table of string values. I want to click on any cell in the 1 st
column and have the cell content copied to a single fixed location cell.
Then
I want a string constant set in a different cell. For the remaining
columns
in the table the action is the same except that the constant string set in
the 2nd target cell is different.

How do I do this?
--
Ken Broten



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
Is Multi click Event possible? Ayo Excel Discussion (Misc queries) 6 August 31st 07 10:42 PM
ListBox Click Event BHatMJ Excel Discussion (Misc queries) 6 June 21st 07 09:34 PM
On click button event [email protected] Excel Worksheet Functions 1 November 30th 06 04:39 PM
Click event for checkbox from Forms toolbar Carolyn Excel Discussion (Misc queries) 6 September 11th 06 08:16 PM
call a function on control click event tkraju via OfficeKB.com Excel Discussion (Misc queries) 7 August 25th 06 07:22 AM


All times are GMT +1. The time now is 10:11 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"