+ Reply to Thread
Results 1 to 8 of 8

if image is present, adjust autoshape

  1. #1
    Forum Contributor
    Join Date
    03-24-2009
    Location
    Vietnam
    MS-Off Ver
    Excel 2010
    Posts
    382

    if image is present, adjust autoshape

    Hi there.

    question from a noob please. How can i let excel check if there is a picture in in a cell of a range in column A, and if yes, select the autoshape in the row cell but column B on sheet2, and adjust its interior color to white?

    Would appreciate if someone could advise me some code
    thanks,
    A2k

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: if image is present, adjust autoshape

    You still need to be using the TopLeftCell property in order to determine a shapes position relative to the worksheet.

    Maybe things would be clearer if you posted small example file
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor
    Join Date
    03-24-2009
    Location
    Vietnam
    MS-Off Ver
    Excel 2010
    Posts
    382

    Re: if image is present, adjust autoshape

    here a quick example. the macro should check if there is a picture in column B on sheet "Picture", and if yes, adjust the shape in the same row but column L on sheet "VIP" to white.

    thanks!
    A2k
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    03-24-2009
    Location
    Vietnam
    MS-Off Ver
    Excel 2010
    Posts
    382

    Re: if image is present, adjust autoshape

    no ideas anyone?

  5. #5
    Registered User
    Join Date
    09-02-2009
    Location
    Edinburgh, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    77

    Re: if image is present, adjust autoshape

    try this

    Please Login or Register  to view this content.
    Last edited by blackworx; 09-05-2009 at 06:17 AM.

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: if image is present, adjust autoshape

    This takes a different approach using webdings2 font rather than images.

    The user defined function returns true or false if the picture is there on sheet picture.

    Please Login or Register  to view this content.
    The formula would be

    =IF(UDF_HASPICTURE("Picture","B" & ROW()),"é","")
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    03-24-2009
    Location
    Vietnam
    MS-Off Ver
    Excel 2010
    Posts
    382

    Re: if image is present, adjust autoshape

    @ blackworks

    thank you very much for this, after making some minor adjustments to your code, it works flawlessly now. This helps me to finalize a project I was torturing myself with for quite a while already. thanks a lot!

    thanks to all the other contributors as well,
    A2k

  8. #8
    Registered User
    Join Date
    09-02-2009
    Location
    Edinburgh, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    77

    Re: if image is present, adjust autoshape

    You're welcome A2k, although Andy's solution is more robust imo. My code is a quick and dirty fix, depends on a lot of assumptions and is therefore quite "brittle". Good luck with the rest of your project

+ 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