PDA

View Full Version : Solved: copying value set to variable



danovkos
08-02-2010, 03:31 AM
hi,
pls. i can not figured out, how to do following.
I have sheet1 and there is a button
i have sheet2 and there are data.

When i am in sheet2 with data i make copy (Application.CutCopyMode is true) and now i select sheet1 and want, when i press this button, that it add value from CutCopyMode set to value "numberID".
i know, that i can not use activecell, because i am in other sheet with other cell. I dont know, how to add value (which is copying- cutcopymode true) set to variable. :(

i tried this, but (of course) it is wrong.


numberID = ActiveCell.Application.CutCopyMode

any suggestions?
thx a lot

Simon Lloyd
08-02-2010, 03:54 AM
perhaps try
numberID = selection, although we could do with more of an explanation and perhaps seeing your workbook so we know what you are trying to do.

danovkos
08-02-2010, 04:10 AM
this code doesnt worked...
my wb is very big and it is hard to make sample from it..

i try to explain again on other example, because i know, that my english is poor :(

I am in sheet1 on cell A100. Here, in this cell is value "123". Now i made ctrl+c, and cutcopymode IS TRUE

Then i select sheet2 (where is selected cell B1..with value "999") and click on button. Value 123 in sheet 1 is still copycut mode true, but now is selected value 999 in sheet2. Your code set to variable value 999, but i want after pressing button set value 123 which is still in cutcopymode = true. .
This is what i try to do :(. I know, that is not very good describtion.

danovkos
08-02-2010, 04:42 AM
i found solution with google :)


MyDataObj.GetFromClipboard
myVar = MyDataObj.GetText()


this code do, what i need

thx for help

danovkos
08-02-2010, 04:50 AM
and after applying this code it works, but after this return



not enough system resources to display completely


how to fix it?
i will use in this clipboard/code maximum 3-5 words or one number with max 10 dig. :(

can i set this for MyDataObj that it will works? :(

Simon Lloyd
08-02-2010, 07:54 AM
Have you tried clearing the clipboard completely first before running the code?
Have a read here http://www.cpearson.com/excel/Clipboard.aspx