Results 1 to 4 of 4

Thread: VBA move and lock image in row

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2017
    Posts
    2

    VBA move and lock image in row

    In each cell I have 1 small image over another big image. With VBA can I move the small image 5cm straight right, and then .05 cm up. Then lock the image together. Then perform the action in next row until there are images in rows of same column.

  2. #2
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,574

    Re: VBA move and lock image in row

    I don't understand everything you're asking, but here's an example of how to move each image on the worksheet to the right:

    Code:
    Sub moveImg()
        Dim ws As Worksheet
        Dim j As Integer
        Dim num As Integer
        
        Set ws = ActiveSheet
        num = ws.Shapes.Count
        
        For j = 1 To num
            If ws.Shapes(j).Type = msoPicture Then
                ws.Shapes(j).Left = ws.Shapes(j).Left + 2
            End If
        Next j
    End Sub

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: VBA move and lock image in row

    what application are you working in? i sort of assumed word, bryce assumed excel


    Then lock the image together
    i assume you want to lock the image to the cell, but if the table moves or resizes, all the image may have to be moved to match

    can you do this manually in the application? can you record a macro to do what you want?

    post a sample document (or whatever type of data file), zip first, to give us a better idea of what you want to do
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  4. #4

    Thread Starter
    New Member
    Join Date
    Jul 2017
    Posts
    2

    Re: VBA move and lock image in row

    Please find the attachment.
    Can we upload one image over another image using VBA ? Image addresses are in Excel column.
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width