+ Reply to Thread
Results 1 to 6 of 6

Resize an image to match a cell

Hybrid View

GBoy Resize an image to match a... 03-29-2007, 12:41 PM
Leith Ross Hello Gboy, The key is to... 03-29-2007, 02:09 PM
GBoy That is ideal, thank you very... 03-29-2007, 05:14 PM
GBoy Out of curiosity what if I... 03-29-2007, 05:16 PM
Leith Ross Hello Gboy, Just reverse... 03-29-2007, 05:22 PM
GBoy Once again many thanks. 03-29-2007, 05:31 PM
  1. #1
    Registered User
    Join Date
    03-02-2007
    Posts
    21

    Resize an image to match a cell

    OK I am trying to resize an image I uplaod in to my worksheet to fit a cell which could potentially vary in size.

    How do I take the size of a cell and tell the image to resize to it?

    I did a search and there are many variations which combine with other requests and I cannot seem to get a clear idea as to what code I require.

    Thanks.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Gboy,

    The key is to use common properties. Both the Cell and the Image share 2 properties relating to they're size: Height and Width.

    Example:
    With Range("E5")
      .Height = Image1.Height
      .Width = Image1.Width
    End With
    Change Image1 to the name of the object you are using in your code.

    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    03-02-2007
    Posts
    21
    That is ideal, thank you very much.

  4. #4
    Registered User
    Join Date
    03-02-2007
    Posts
    21
    Out of curiosity what if I wanted to resize a cell to the size of an image?

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Gboy,

    Just reverse the objects...

    With Image1
      .Height = ActiveSheet.Range("A5").Height
      .Width = ActiveSheet.Range("A5").Width
    End With
    Sincerely,
    Leith Ross

  6. #6
    Registered User
    Join Date
    03-02-2007
    Posts
    21
    Once again many thanks.

+ 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