Copy Cell Content on Click

excelnow

Board Regular
Joined
Nov 17, 2009
Messages
106
Hi,

I am not sure if this is possible because I couldn't find anything about this on the web and on this forum.

I want to copy the cell content(text) when I click on it. Can this be done via code?

Thanks
 
hrmmmm.... I know how to select a reference but how do I know which one to select?



btw, thanks for your help and patience with me, I appreciate it very much!
 
Upvote 0

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
ahhhh.... okay, I see now. Sorry about that. I look through the references list and there doesn't appear to be a Microsoft Forms 2.0 Object Library. Would I have to find and install this?
 
Upvote 0
You need to check carefully. The listing is not entirely alphabetic. On my system the Microsoft Forms library is fairly close to the top of the list.
 
Upvote 0
I'm running MS Excel 2003, version 6.1.7601 SP1 Build 7601 on Windows 7 OS.

I went through the list again and it appears everything is in alphabetical order for me. I downloaded and installed the MS Forms and check references list again but the closest thing I found was "Microsoft Feeds 2.0 Library" instead. I selected that but got same results. I'm going to investigate further-This is strange.
 
Upvote 0
You should just be able to add a userform from the Insert menu in the VBE. You won't need any coding for it.
 
Upvote 0
ahhhh..... okay, I've inserted it and now I see the MS Forms 2.0 Library and it's now selected and the script runs, however when I select a cell in the spread sheet I'm still getting "compile error: Procedure declaration does not match description of event or procedure having the same name."

Here's the code I pasted:

Private Sub Workbook_SheetSelectionChange(ByVal Target As Range)

If Intersect(Target, Range("A1:J281")) Is Nothing Then Exit Sub

Dim DataObj As New MSForms.DataObject
Dim S As String
S = ActiveCell.Text
DataObj.SetText S
DataObj.PutInClipboard

Dim DataObj As New MSForms.DataObject
Dim S As String
DataObj.GetFromClipboard
S = DataObj.GetText
Debug.Print S

End Sub
 
Upvote 0
It should be

Code:
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
 
Upvote 0

Forum statistics

Threads
1,225,190
Messages
6,183,455
Members
453,160
Latest member
DaveM_26

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top