Quantcast
Channel: port135.com
Viewing all articles
Browse latest Browse all 306

How to organize images automatically in an Excel file using a macro?

$
0
0

If you add multiple images at once to an Excel file, Excel will try to squeeze them in once cell. It will probably look like the screenshot below.

Instead of manually resizing and relocating these images, you can use the macro below to automatically organize all images in milliseconds.

Sub organizeImages()
     lastTop = 0
     staticHeight = 500

     For Each pic In Worksheets("Sheet1").Pictures
          pic.Top = lastTop
          pic.Height = staticHeight
          lastTop = lastTop + pic.Height + 15
          pic.Left = 0
     Next pic
End Su

Images resized and relocated automatically:


Viewing all articles
Browse latest Browse all 306

Trending Articles