+ Reply to Thread
Results 1 to 11 of 11

Fit pasted pictures into middle of cells consecutively

  1. #1
    Registered User
    Join Date
    10-09-2014
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    49

    Fit pasted pictures into middle of cells consecutively

    Hi

    Looking for a macro that fits pictures I paste into the middle of the cell. I need to update order forms weekly and do not have time to manually place each image.
    When I paste images from the exported file to new form it doesn't place them properly. Both Exported and Order Form have a row height of 120 so you'd think it would paste it to mirror original but it doesn't.

    Sample worksheet attached. More images would be shown but reduced due to file size.

    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: Fit pasted pictures into middle of cells consecutively

    Maybe that way, but you have to check it out:
    (You can split it into two independent macros)
    Please Login or Register  to view this content.
    The code snippet (fragment of the code) from the topic below was applied:
    https://www.excelforum.com/excel-pro...ror-400-a.html
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    10-09-2014
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    49

    Re: Fit pasted pictures into middle of cells consecutively

    So it's almost there but when i run it on all imagery it doesn't place them in the center of the cell vertically & horizontally. As I scrolled through parts of the images were still covering the cell black boarder of the cell. If I need to increase the row height i will but need to get the images centered and place first.
    Master file attached.
    Thx

  4. #4
    Registered User
    Join Date
    10-09-2014
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    49

    Re: Fit pasted pictures into middle of cells consecutively

    I tried to copy the code above into a new module under my PERSONAL macros and when I run the macro it keeps coming up with "Compile error: Can't find project or Library"?

  5. #5
    Registered User
    Join Date
    10-09-2014
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    49

    Re: Fit pasted pictures into middle of cells consecutively

    Goal is to run a macro that goes to column B and take 1st image and fit it into cell B2, then next image into cell B3 etc...
    Once that's done I can then cross check to see if any cells are missing imagery as it's possible our system isn't loaded with everything. But I'd rather fix 1 or 2 than re-place 50.

  6. #6
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: Fit pasted pictures into middle of cells consecutively

    1. Try:

    Code below paste to the worksheet module ("SU18").
    Whenever you change the size of a row / column, select any cell and the images will fit to cells.
    Please Login or Register  to view this content.
    Below corrected code for 'Module1'
    Please Login or Register  to view this content.
    2. "Compile error: Can't find project or Library"
    Which one "References" you have marked/selected in Tools\References option of vba editor ?
    Maybe something is unchecked or missing some file '.dll'.

  7. #7
    Registered User
    Join Date
    10-09-2014
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    49

    Re: Fit pasted pictures into middle of cells consecutively

    I'm not very savvy at this so I could use your help on adding this properly to my Personal macros so I may use it on the new reports I run each week.

  8. #8
    Registered User
    Join Date
    10-09-2014
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    49

    Re: Fit pasted pictures into middle of cells consecutively

    Actually I think I got it and it totally works!!! THANK YOU!
    Final question...can I change the Tab heading of SU18? Will that effect the code or not?

  9. #9
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: Fit pasted pictures into middle of cells consecutively

    No, it will not.
    It would be important if, for example, in "Workbook_SheetSelectionChange (ByVal Sh As Object, ByVal Target As Range)" would be literally named sheet names, but not here.
    However, will be important the names of shapes/images/pictures you will have in your workbook, e.g.:
    Please Login or Register  to view this content.
    If they don't have names in the schema above, then it will be an error or something else strange.

  10. #10
    Registered User
    Join Date
    10-09-2014
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    49

    Re: Fit pasted pictures into middle of cells consecutively

    Ok. I should be good then. image names will change base don season but if macro is set up to just move any image I add it should work fine

  11. #11
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: Fit pasted pictures into middle of cells consecutively

    With the exception of "Picture 2" (RVCA), the macro changes all images like "*Untitled Image*" (all the pictures in your workbook have the name "Untitled Image") to another names like "Apparel 2", "Apparel 3", "Apparel 4", etc.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to reduce file size (lots of pictures pasted into workbook)
    By michellepace in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 12-02-2016, 03:48 AM
  2. copy current cells and fill the empty cells below it consecutively
    By jitterbug888 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-09-2016, 10:34 PM
  3. [SOLVED] select all pictures pasted in a workbook
    By luv2glyd in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-16-2016, 05:59 PM
  4. [SOLVED] Consecutively numbering cells
    By Pixel-taker in forum Office 365
    Replies: 9
    Last Post: 04-07-2015, 11:33 PM
  5. Name cells consecutively in first row as a loop?
    By perola.rike in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 05-23-2014, 03:46 PM
  6. [SOLVED] Need formula to sum range of cells consecutively across a row not duplicating used cells
    By angie18a in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-28-2013, 03:46 PM
  7. Replies: 14
    Last Post: 05-10-2013, 03:27 PM

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