ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Appending contents of clipboard to a selected cell range (https://www.excelbanter.com/excel-programming/382301-appending-contents-clipboard-selected-cell-range.html)

Poster

Appending contents of clipboard to a selected cell range
 
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


Tom Ogilvy

Appending contents of clipboard to a selected cell range
 
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.

--
Regards,
Tom Ogilvy



"Poster" wrote:

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



NickHK

Appending contents of clipboard to a selected cell range
 
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

"Poster" wrote in message
oups.com...
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





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

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