ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Function not performing copy (https://www.excelbanter.com/excel-programming/297076-function-not-performing-copy.html)

ppsza[_3_]

Function not performing copy
 
For a variety of solid reasons that are too lengthy and irrelevant t
get into here, I have the following setup: a cell that contains th
following formula:

=GetTheText("D95", "D49")

(D95 and D49 are just examples. What is important is that the cell tha
contains this formula is neither cell D95 or D49.)

Here is the GetTheText function:

Function GetTheText(SourceCell As String, TargetCell As String)

Range(SourceCell).Select
Selection.Copy
Range(TargetCell).Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone
SkipBlanks:= _
False, Transpose:=False

End Function

Nothing seems to happen. When I check the clipboard it shows nothing i
there. Is there any reason why a function might refuse to put a valu
into another cell? Seems unlikely. Can anyone help, please?

thank you!

the code

--
Message posted from http://www.ExcelForum.com


Juan Pablo González

Function not performing copy
 
'Cause functions are not allowed to change their environment, they can only
return a variable.

--
Regards,

Juan Pablo González

"ppsza " wrote in message
...
For a variety of solid reasons that are too lengthy and irrelevant to
get into here, I have the following setup: a cell that contains the
following formula:

=GetTheText("D95", "D49")

(D95 and D49 are just examples. What is important is that the cell that
contains this formula is neither cell D95 or D49.)

Here is the GetTheText function:

Function GetTheText(SourceCell As String, TargetCell As String)

Range(SourceCell).Select
Selection.Copy
Range(TargetCell).Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False

End Function

Nothing seems to happen. When I check the clipboard it shows nothing in
there. Is there any reason why a function might refuse to put a value
into another cell? Seems unlikely. Can anyone help, please?

thank you!

the code:


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 04:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com