Clipboard Data Within Macro

P

Phil

Is there a way to use data a user saved in the clipboard
prior to running my macro. Or, is there a way to prompt
the user to select a range of data to copy to the
clipboard.

I attempted to use the InputBox Method with a Type:=8
setting but I get an error when I attempt to set the
return value to a variable which I declared as being of
type Range, and then try to select that range. The
specific error I get is "Run-Time error '1004'
Method 'Range' of object '_Global' failed.

------------------------
Dim Data_Copy_Range As Range

Set Data_Copy_Range = Application.InputBox(prompt:="Enter
copy range.", Type:=8)

Range(Data_Copy_Range).Select
 
O

onedaywhen

You object variable Data_Copy_Range points to the chosen range, so the
line of code should be:

Data_Copy_Range.Select

Note Chip Pearson's excellent code to which Steve refers is for
copying text rather than an Excel Range to the clipboard, so isn't
appropriate here.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top