+ Reply to Thread
Results 1 to 2 of 2

vba to size and center picture in cell (vertical and horizontal)

  1. #1
    Registered User
    Join Date
    04-25-2011
    Location
    Boston, MA
    MS-Off Ver
    Excel 2003
    Posts
    24

    vba to size and center picture in cell (vertical and horizontal)

    I have some spreadsheets with .jpgs inserted to some cells. I need to size the jpg to fit the cell and then center both vertically and horizontally. I found this post,
    http://answers.microsoft.com/en-us/o...8-36eba495a4d7

    which has some things in it that are close, but I can't quite figure how to modify for what I need. I am inserting with copy and paste, not insert from file, so the code needs to working on an existing jpg.

    Please Login or Register  to view this content.
    The above works for centering horizontally, but not vertically and does not size the jpg.

    Thanks for the help.

    LMHmedchem

  2. #2
    Registered User
    Join Date
    04-25-2011
    Location
    Boston, MA
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: vba to size and center picture in cell (vertical and horizontal)

    After guessing a bit, the following will center the jpg both vertically and horizontally. You just select the image, do the keystroke to activate the macro (I set it to ctrl+y), and select the cell.

    Please Login or Register  to view this content.
    If anyone can help with how to auto size the jpg to fit the cell, that would be a big help. This is the insert and scale code I got from answers.microsoft.com, but I can't quite see how to do the scaling.
    Please Login or Register  to view this content.
    It seems as if it would need to be sized before it is centered, but perhaps it doesn't need to be centered if it is sized?

    LMHmedchem
    Last edited by LMHmedchem; 10-23-2012 at 02:37 PM.

+ 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