Close Gap Between Objects

pure vito

Board Regular
Joined
Oct 7, 2021
Messages
180
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I'm browsing the internet to no avail, I'm pasting these images onto my sheet and as you can see they are small enough to fit nicely in the cells the only problem I have
is when pasted they are very far apart meaning I have to manually drag them to the cell I need them in, is there any way to select all the objects and decrease the gap between the images, I have used all the align options
but none of those options can close the gap 🤔 any help would be greatly appreciated 💪


1677576636118.png
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Thank you I'm not sure this is the solution I am looking for I think this would require me to save and name all the images?

I'd just like to bring them all closer together without assigning them to cells if that makes sense,
 
Upvote 0
Hmm, not sure that this is actually along the lines of what you are after but give it a run in a copy of your worksheet.

VBA Code:
Sub ShapesCloser()
  Dim sh As Shape, shact As Shape
  
  Const shLeft As Long = 100
  Const shGap As Long = 5
  
  Application.ScreenUpdating = False
  For Each sh In ActiveSheet.Shapes
    If shact Is Nothing Then
      sh.Top = 10
      sh.Left = shLeft
      Set shact = sh
    Else
      sh.Top = shact.Top + shact.Height + shGap
      sh.Left = shLeft
      Set shact = sh
    End If
  Next sh
  Application.ScreenUpdating = True
End Sub
 
Upvote 0
Solution
Hey Peter 🖐️ , That's fantastic! what a dream :cool: this is going to save me hours of work thank you very very much once again you've come to my rescue, with any luck one day I'll have the solutions to someone else's problem :giggle: many thanks
 
Upvote 0
Cheers. Glad it worked for you - I was unsure. 😎
Thanks for the follow-up. :)
 
Upvote 0

Forum statistics

Threads
1,216,116
Messages
6,128,929
Members
449,479
Latest member
nana abanyin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top