+ Reply to Thread
Results 1 to 4 of 4

Insert Picture in cell, click commanbutton to rename picture, lock cell and remove button

  1. #1
    Forum Contributor
    Join Date
    08-22-2009
    Location
    Manitoba
    MS-Off Ver
    Office 2010
    Posts
    517

    Insert Picture in cell, click commanbutton to rename picture, lock cell and remove button

    I have a workbook that will be distributed to co-workers. There is one page visible where there is 6 cells unlocked for them to size a picture to fit the area. Beside this is a "commandbutton1" which they will then click, changing the name of the picture to "picture 1", locking cells, changing to none what users are allowed to do after protecting, removing the commandbutton and lock the sheet. I have tried doing this with the recorder, but it seems to miss steps. I do not know what the picture will be called when fit into the open cells, how do I name this to rename it? Is there a wildcard? Thanks.

  2. #2
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474

    Re: Insert Picture in cell, click commanbutton to rename picture, lock cell and remove but

    Try the following code, which needs to be placed in the code module for the sheet (right-click the sheet tab, and select 'View Code')...

    Please Login or Register  to view this content.
    If the worksheet is protected without a password, replace...

    Please Login or Register  to view this content.
    with

    Please Login or Register  to view this content.
    Also, the merged cells do not need to be Locked in order to insert a picture. So if the user only needs to insert a picture and doesn't need to enter any data within the merged cells, they can be left Locked and the following lines of code can be deleted...

    Please Login or Register  to view this content.
    Note that in a protected worksheet "Edit Objects" needs to be checked in order to allow users to insert a picture.

    Hope this helps!

  3. #3
    Forum Contributor
    Join Date
    08-22-2009
    Location
    Manitoba
    MS-Off Ver
    Office 2010
    Posts
    517

    Re: Insert Picture in cell, click commanbutton to rename picture, lock cell and remove but

    Thanks Domenic! Works awesome! What triggers the message? I have not been able to get it to pop up.

    Figured it out. I had my image off to the side, but it was called the same, so it must have picked it up. I deleted it and ran the macro and then the message appeared, voila!

    Thanks again!
    Last edited by thecdnmole; 09-28-2014 at 06:28 PM.

  4. #4
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474

    Re: Insert Picture in cell, click commanbutton to rename picture, lock cell and remove but

    Yeah, the message will appear when there's no picture within the merged cells.

    I'm glad I could help. And thanks for the feedback.

    Cheers!

+ 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. Click on picture and run macro to replace existing picture with selected picture file
    By houseflipsheet in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-14-2014, 12:02 AM
  2. How do I lock picture that I insert in worksheet
    By jamshoot in forum Excel General
    Replies: 0
    Last Post: 07-10-2013, 09:55 AM
  3. VBA for Picture insert at particular worksheet range. Picture name derived from cell.
    By Douglas2013 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-09-2013, 01:16 AM
  4. To have the picture to appear when click on a button or cell
    By Grace14 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-20-2012, 05:07 AM
  5. [SOLVED] how do i lock a picture in a cell
    By Catherine in forum Excel General
    Replies: 1
    Last Post: 03-22-2005, 02:06 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