+ Reply to Thread
Results 1 to 11 of 11

inserting multiple pictures

  1. #1
    Valued Forum Contributor
    Join Date
    11-16-2004
    Location
    Devon UK
    MS-Off Ver
    2010
    Posts
    357

    inserting multiple pictures

    I am trying to insert a large number of pictures into specific cells (or rather on top of the cells) which contain the picture filename, the pictures being resized to the size of the cell.

    I have searched the site and found lots of useful help particularly the code below provided by RoyUK.

    I have changed this using cell (4,13) as a fixed destination intending to change these references to variables which I can then change to insert more pictures.

    Unfortunately I can't get this to work. in it's current form it fails at line
    Please Login or Register  to view this content.
    any help on this code or alternative suggestions would be great.

    Please Login or Register  to view this content.
    Last edited by tryer; 10-19-2008 at 07:59 AM.

  2. #2
    Forum Contributor Stuie's Avatar
    Join Date
    09-17-2006
    Location
    Suffolk, UK
    MS-Off Ver
    Excel 2003/2007
    Posts
    432
    have you tested it with break points to make sure that you not trying to reference a cell with a negative number??
    There are only 10 types of people in the world:
    Those who understand binary, and those who don't!

  3. #3
    Valued Forum Contributor
    Join Date
    11-16-2004
    Location
    Devon UK
    MS-Off Ver
    2010
    Posts
    357
    Stuie,
    I think the problem arises from my use of "Range("4:13")" as the variable targetcells is empty. In what way should I change this to refer to a single cell as opposed to a range

  4. #4
    Forum Contributor Stuie's Avatar
    Join Date
    09-17-2006
    Location
    Suffolk, UK
    MS-Off Ver
    Excel 2003/2007
    Posts
    432
    To refer to a single cell you can use one of these two ways

    Please Login or Register  to view this content.
    then just change the referrance between the ( ).

  5. #5
    Valued Forum Contributor
    Join Date
    11-16-2004
    Location
    Devon UK
    MS-Off Ver
    2010
    Posts
    357
    I've found changing the line
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    doesn't work so I guess the syntax must be wrong

  6. #6
    Forum Contributor Stuie's Avatar
    Join Date
    09-17-2006
    Location
    Suffolk, UK
    MS-Off Ver
    Excel 2003/2007
    Posts
    432
    when you use the cells() you cant put in " " so just Cells(1, 1).

    to cast a range of cells you can use this

    Please Login or Register  to view this content.
    and that would be referencing cells from A1 to B10

  7. #7
    Valued Forum Contributor
    Join Date
    11-16-2004
    Location
    Devon UK
    MS-Off Ver
    2010
    Posts
    357
    Thanks Stuie, That has got it working (for this sample fixed cell)

    Now hopefully I can progress to get it working on multiple cells

  8. #8
    Forum Contributor Stuie's Avatar
    Join Date
    09-17-2006
    Location
    Suffolk, UK
    MS-Off Ver
    Excel 2003/2007
    Posts
    432
    lol no probs .

    one thing to google that may help you is range array's. it allows you to make a collection of ranges in an array making it much easier (if thats something your work would need anyway).

  9. #9
    Valued Forum Contributor
    Join Date
    11-16-2004
    Location
    Devon UK
    MS-Off Ver
    2010
    Posts
    357
    UMM yes i'm sure your right that refering to a range would be my best option. Unfortunately try as I have I don't have a good understanding of ranges.

    Ideally I would like to say something like:

    for every cell in range ("M3:W200) if the cell contains a filename then insert the picture and resize it to the cell size.

    What I have now does this for a single cell. I most probable will end up stepping through each row & column in order to arrive at each cell. But before doing this I will do some more reading on ranges

  10. #10
    Forum Contributor Stuie's Avatar
    Join Date
    09-17-2006
    Location
    Suffolk, UK
    MS-Off Ver
    Excel 2003/2007
    Posts
    432
    if you want to check every cell in a range use this piece
    Please Login or Register  to view this content.
    of code

    Please Login or Register  to view this content.

  11. #11
    Valued Forum Contributor
    Join Date
    11-16-2004
    Location
    Devon UK
    MS-Off Ver
    2010
    Posts
    357
    Thanks Stuie, almost got it working now

    I changed the code to
    Please Login or Register  to view this content.
    and it works fine until it comes to an empty cell. so I changed it to
    Please Login or Register  to view this content.
    But unfortunately it fails at the line If cl.Value = "" Then Next cl

    what am I doing worng?

+ 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. Multiple Pictures In A Price List
    By Craig_Abode in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-09-2008, 10:03 AM
  2. Replies: 2
    Last Post: 09-20-2008, 11:00 AM
  3. Inserting multiple rows of one column into...
    By jmycr in forum Excel General
    Replies: 1
    Last Post: 08-22-2008, 07:56 PM
  4. Need to transfer sheet + pictures to multiple computers.
    By firemanmsmith in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-19-2008, 04:16 PM
  5. Inserting multiple values within a single cell.
    By maacmaac in forum Excel General
    Replies: 1
    Last Post: 09-25-2007, 05:41 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