Paste range from Clipboard to Excel

G

Guest

Hi, I'm trying to use Clipboard from VBA in Excel 2000.
I can paste a single cell from the Clipboard using DataObject and related
methods (MSForms 2.0 obj library) but I can't manage a range of cells.
After selecting and copy a range of cells from Excel to the Clipboard, with
Clipboard Viewer I can see only one text string (from the last cell) and no
formulas.

Should I try with WinAPI calls??? I searched Internet and I've found a tool
(API Viewer) to look at the declares statement of a DLL, i.e.:
Declare Function GetClipboardData Lib "user32" (ByVal wFormat As Long) As Long
but I've never used it before.
I'd like to do a macro that can check if the Clipboard contains a range from
Excel and then make an "exact copy" of all the range formulas into a new
worksheet / workbook without formula address changes.
Thank you for any suggestion ????
 
T

Tom Ogilvy

don't copy.

bk.worksheets(1).Range("A1").Formula = _
bk2.worksheets(3).Range("B9").formula
 
G

Guest

Ok, thank you for the suggestion.
I know that I can solve the problem with a simple macro that ask the user to
select a range to copy from, and then select a single cell (upleft of the
range) in a new wkbook / wksheet where to put an "exact copy" of the
formulas, but I'd try to add a new "paste special" menu item for "exact
formula copy" that run my macro (to distribute to my collegue as Excel
add-in).
Thanks for the help
 
J

Jef Gorbach

Tom Ogilvy said:
don't copy.

bk.worksheets(1).Range("A1").Formula = _
bk2.worksheets(3).Range("B9").formula

--
Regards,
Tom Ogilvy

As

Is there a similar "shortcut" to copy Book1.Sheet1 to ActiveWorkbook.Sheet1
?

Record Macro came up with:
Windows("Book1").Activate
Cells.Select
Selection.Copy
ThisWorkbook.Sheets("Sheet1").Activate ActiveSheet.Paste
 

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