+ Reply to Thread
Results 1 to 6 of 6

How do I paste an image into each cell into a define range using VBA?

  1. #1
    Registered User
    Join Date
    10-06-2003
    Location
    Ashford, Kent - Working in London
    MS-Off Ver
    Office 365
    Posts
    95

    How do I paste an image into each cell into a define range using VBA?

    Hello all from a cold Birmingham, England.

    I’ve created a worksheet which creates (as yet untested) barcodes and I have tried, successfully, to then copy and paste the barcode as an image into a specific cell. However, in order to create printable sheets of labels with these barcodes on I need to paste the newly created barcode image into multiple but non-adjoined cells. Because the number of cells and address of these cells varies depending on the labels being printed, I need to select and define the cells as a name and then have the barcode images pasted into them all, but everything I try results in the image only being pasted into the first cell in the defined range.

    My question in a nutshell is:
    What code should I use to paste an image into each cell in a non-contiguous defined range where the cells in that range can be different in location and number based on which labels are to be printed? I know this will start with the user having to select the cells and define the name, but how do I paste the image into each cell in that defined range once they've done that?

    Thanks for looking.

    Chris.
    Big Chris

  2. #2
    Registered User
    Join Date
    01-29-2012
    Location
    United Kingdom
    MS-Off Ver
    MS Office 2003/MS Office 2010
    Posts
    45

    Re: How do I paste an image into each cell into a define range using VBA?

    Rather than pastin into range, can't you paste in upper left corner and then move them to theire possitions depending on what labels are going to be printed?
    This is what i used:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-06-2003
    Location
    Ashford, Kent - Working in London
    MS-Off Ver
    Office 365
    Posts
    95

    Re: How do I paste an image into each cell into a define range using VBA?

    I could, but this is for users with low to moderate Excel skills and the master plan is that when they select a product and a label type the barcode image will be generated and pasted into the defined areas for them. Therefore it needs to be fairly idiot proof rather than having to create bespoke distance from top and bottom depending on the variables involved.

    If I select multiple cells in a worksheet and paste data from AN other cell it pastes that data into all the selected cells....but it only pastes images into the first cell selected. And knowing how to have images paste as data does would give me exactly what I'm looking for.

    Thanks for looking though Trenars!

    Chris.

  4. #4
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: How do I paste an image into each cell into a define range using VBA?

    Rough example (tested in 2010)
    Please Login or Register  to view this content.
    Good luck.

  5. #5
    Registered User
    Join Date
    10-06-2003
    Location
    Ashford, Kent - Working in London
    MS-Off Ver
    Office 365
    Posts
    95

    Re: How do I paste an image into each cell into a define range using VBA?

    Brilliant!

    Thanks OEGO that does the job exactly as I need it :-)

    Thanks too to 'trenars' for taking the time to respond earlier.

    Chris.

  6. #6
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: How do I paste an image into each cell into a define range using VBA?

    My pleasure. Please do not forget to mark the question Solved.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1