+ Reply to Thread
Results 1 to 6 of 6

Insert picture and resize to range of cells

  1. #1
    Registered User
    Join Date
    06-18-2008
    Posts
    32

    Insert picture and resize to range of cells

    I am trying to create a button that lets you select a picture then insert and resize the picture into a given selection of cells using some code borrowed from here http://www.exceltip.com/st/Insert_pi...Excel/486.html but I can not seem to get it to work.

    Here is the code I am using.

    Please Login or Register  to view this content.
    And I keep getting an error as soon as it hits t=.Top.

    I get this error: Run-time error '424' : Object required

    Can someone please help me with this?

    Also, how can I add this to a module and call it in CommanButton1_Click()? I am pretty new to VBA

    Thanks,

    Eric

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You have incorrectly used Set, but also your variaables are not declared. Try this

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    06-18-2008
    Posts
    32
    Thank you very much! Worked like a charm!

  4. #4
    Registered User
    Join Date
    06-27-2007
    Posts
    23

    Picture Sizing

    Quote Originally Posted by royUK View Post
    You have incorrectly used Set, but also your variaables are not declared. Try this

    Please Login or Register  to view this content.
    What formula could I add to this that would make the inserted picture fill a cell? I have merged columns A-F and rows 10-30 into one big cell and would like the picture to fill this area.

  5. #5
    Registered User
    Join Date
    06-18-2008
    Posts
    32
    Quote Originally Posted by hayhursm View Post
    What formula could I add to this that would make the inserted picture fill a cell? I have merged columns A-F and rows 10-30 into one big cell and would like the picture to fill this area.
    Just change the range in this code
    Please Login or Register  to view this content.
    to Range("A10:F30")

  6. #6
    Registered User
    Join Date
    01-25-2013
    Location
    dc
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Insert picture and resize to range of cells

    How can I alter this code so that an image will fill up the entire range? I would like aspect ratio's off, and the image to be able to fill any dimension I tell it. I know that this will make the image distorted and that is okay.

    Please Login or Register  to view this content.

+ 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