Appending contents of clipboard to a selected cell range

  • Thread starter Thread starter Poster
  • Start date Start date
P

Poster

Greetings. I maintain a large group of spreadsheets that require the
same text to be appended to the contents of various cells. These cell
ranges are not known in advance.

I'm looking for a macro that does this:

* Appends the content of the clipboard (including font format) to each
cell in a range. This range of cells is not hardcoded within the
macro.

So far I have not been able to find a macro that does such a thing, or
even the information necessary to code it. Any advice appreciated.

Thanks.
-- Poster
 
If you want to do Rich Text formatting, I believe the easiest would be to
paste the clipboard to a cell, then have your macro capture the text and
formatting in that cell and reproduce it character by character in your
target cells using the characters collection.

Turn on the macro recorder and rich text format an existing string, then
turn off the macro recorder. This will give you a good example of using the
characters collection.
 
Inherent VBA access to the clipboard is limited to the DataObject. But
according to help "The DataObject currently supports only text formats."
This is in XL XP, so not sure if the "currently" still applies in later
versions.
If so, and you need the formatting, then go Tom's way. Otherwise use the
DataObject.

NickHK
 

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

Back
Top