Results 1 to 10 of 13

Thread: [Article & AddIn] How to paste into a filtered range

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member Andreas Killer's Avatar
    Join Date
    Aug 2025
    Posts
    17
    Rep Power
    0

    Post Overview

    If you have looked at the code in the AddIn, you will probably notice that it is more extensive than expected.
    Unfortunately it is not that easy in Excel to solve this task.

    And I have to be fair to say that I don't really do a Paste as it is possible in Excel, because that would also have to include formulas, colors, fonts, borders and more. I limit exclusively to values and, if necessary, number formats, even if more would be possible.

    So why all this effort? Couldn't it be easier?

    Well, a big advantage of this AddIn is that it works not only with cells, but also with other sources, for example a website (if it defines a table). This was my starting point in the past, I often had to copy data from websites / PDF files. For me it was worth the effort.

    And easier... if you accept detours and peculiarities... perhaps. Many programmers have attempted this task... judge for yourself. And by the way, this code wasn't like this from the beginning, I also learned a lot over the years.

    Let me first point out the problems we have to deal with, and then let's look at the details of the solution.

    The first problem is where do we get the data that we want to write to the target cells, there are 2 possibilities: If cells have been copied, then the source cells themselves or, if they are not accessible, the clipboard.

    When you start with Excel, everything seems to work very simply and logically at the beginning. But after a time, you come across curiosities that you can't explain.
    Above all, it's a date that suddenly and unexpectedly appears on the screen, even though you didn't want it to be.

    Try it out for yourself, open Excel and write 1-2-3 in a cell. To us as humans, this looks like a bulleted list, but in Excel, it becomes a date.
    Why is that? This brings us to the problem of data conversion and the automatisms in Excel.

    Inside the clipboard are 2 structures that we use for our purpose the HTML Format and XML Spreadsheet.

    After that, we have to deal with how to recognize the visible cells in the filtered range and how to write the data only to them.
    If you now consider that the range to be copied and the target range can be different in size, you know it’s not easy. Let's add ranges of different sizes to our list.

    These are the big topics on our list, and each topic has some details that we need to discuss if we want to understand what happens in Excel resp. how Excel works.

    I divide the topics into separate posts, then it will be easier for you later when you want to read again.

    Take a big cup of tee or coffee and let's get started.
    Last edited by Andreas Killer; 09-07-2025 at 03:06 PM.

Similar Threads

  1. Replies: 1
    Last Post: 07-27-2020, 12:09 AM
  2. Replies: 0
    Last Post: 09-26-2018, 02:37 PM
  3. populate control from named range stored in addin
    By MrBlackd in forum Excel Help
    Replies: 8
    Last Post: 05-11-2016, 04:46 PM
  4. Replies: 5
    Last Post: 03-25-2016, 04:28 AM
  5. Unique Count on a Filtered Range
    By Admin in forum Excel and VBA Tips and Tricks
    Replies: 0
    Last Post: 08-14-2011, 04:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •