+ Reply to Thread
Results 1 to 3 of 3

Macro for centering jpg in excel cell

  1. #1
    Registered User
    Join Date
    02-09-2016
    Location
    Sweden
    MS-Off Ver
    Office professional plus 2010
    Posts
    2

    Macro for centering jpg in excel cell

    Hello, new member. I will try to be as precise as I can here, bear with me though, I am a complete novice when it come to Macros.

    What I am looking for:
    I am working on a document, a competence matrix. I want to make it easy and smooth to use so I have created circles filled 0,25,50,75,100% to illustrate competence levels. These are in jpg format.The thing is that when I copy and paste these into the matrix they end up non centered so you have to manually align them. Not a huge issue but I was hoping it could be fixed with a macro. Knowing my limitations I figured someone else who knows this a whole lot better than me might have done it already I found this:

    Please Login or Register  to view this content.
    It work, sort of. First of "With ActiveSheet.Shapes(1)" ,and more specifically the number, somehow dictates which object should be used. I honestly have no idea how the selection is made, I guess the original macro was designed for just one object, but after some trial and error (changing the number) I could figure out which number related to which object in my worksheet.
    So how it works now is I connected a macro to each object, so when I select a cell and click the object I want in that cell it moves there and is centered. So far so good, but what I actually would like to happen is that the object is copied to the selected cell rather than moved. Is that doable?
    As I said I am quite new at all things macro related so keep it simple if possible, thanks.
    Last edited by Zjiv; 02-09-2016 at 11:51 AM.

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,962

    Re: Macro for centering jpg in excel cell

    You can name the shapes when they are selected (using the name box). To copy a specific shape, use code like this:

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    02-09-2016
    Location
    Sweden
    MS-Off Ver
    Office professional plus 2010
    Posts
    2

    Re: Macro for centering jpg in excel cell

    Worked just fine, thanks

+ 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. Replies: 4
    Last Post: 06-11-2015, 07:55 PM
  2. Centering Content in a Cell With Wrapped Text
    By josiah_keller in forum Excel General
    Replies: 0
    Last Post: 01-28-2013, 08:30 PM
  3. Bug In Centering Text In A Cell?
    By nimaje in forum Excel General
    Replies: 4
    Last Post: 07-11-2012, 08:05 AM
  4. Centering the screen on a specific cell upon open
    By hriggs in forum Excel General
    Replies: 2
    Last Post: 03-25-2009, 09:53 AM
  5. Centering on a Hyperlinked cell
    By rs56369 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-12-2008, 09:18 AM
  6. Centering a cell on the screen
    By Aurbo99 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-12-2007, 05:10 AM
  7. [SOLVED] Centering a Shape over a given cell when resizing
    By Linking to specific cells in pivot table in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-13-2005, 08: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