ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Excel and pictures....a few questions... (https://www.excelbanter.com/excel-discussion-misc-queries/71632-excel-pictures-few-questions.html)

marko

Excel and pictures....a few questions...
 
Hi!

Here is the problem. I work in excel and i have to insert some
pictures(about 30-50 of them), lets say all pictures from a specific
folder. so i go to insert -- picture -- from file. thats fine. All my
pictures are the same dimension- 640x480 and when i put them in excel
some are big and some are small! why is that?

now i have a VB question. How can i select all of these pictures
through VBA. i would like VBA to select all pictures on the active
sheet, i know how to resize them.

And the last question. Is there a way with VBA to take all pictures on
a sheet and put them i rows and columns so that it looks nice, and
align them. i would like 5 pictures to be in a row and if there are 40
pictures there would be 8 rows, so that i can see them all and that
they are aligned!
sorry for my bad english! :)
Thanks in advance for any help!

Marko Svaco


Eric_MUC

Excel and pictures....a few questions...
 
Hi marko,

for selecting all images on your worksheet simply use:

ActiveSheet.Shapes.SelectAll

for your question about aligning the images in rows and cols try to use this
code:

Private Sub Sort_All_Images()
Dim intI As Integer, intTop As Integer, intLeft As Integer

With ActiveSheet

intTop = 1
intLeft = 1

For intI = 1 To .Shapes.Count

If intI / 5 < Int(intI / 5) Then
.Shapes(intI).Top = intTop
.Shapes(intI).Left = intLeft
intLeft = intLeft + 100
Else
.Shapes(intI).Top = intTop
.Shapes(intI).Left = intLeft
intTop = intTop + 100
intLeft = 1
End If

Next intI

End With

End Sub

You can even adjust the 100 as you would like to (best would be if these
values are higher than the height and width of the images...

Did this help you?

Best wishes,
Eric



"marko" wrote:

Hi!

Here is the problem. I work in excel and i have to insert some
pictures(about 30-50 of them), lets say all pictures from a specific
folder. so i go to insert -- picture -- from file. thats fine. All my
pictures are the same dimension- 640x480 and when i put them in excel
some are big and some are small! why is that?

now i have a VB question. How can i select all of these pictures
through VBA. i would like VBA to select all pictures on the active
sheet, i know how to resize them.

And the last question. Is there a way with VBA to take all pictures on
a sheet and put them i rows and columns so that it looks nice, and
align them. i would like 5 pictures to be in a row and if there are 40
pictures there would be 8 rows, so that i can see them all and that
they are aligned!
sorry for my bad english! :)
Thanks in advance for any help!

Marko Svaco



marko

Excel and pictures....a few questions...
 
YOU ARE A GENIOUS!!!!!!!!!!!
IT WORKS PERFECTLY!!!!!
THANKS A MIOLLION!!!!!!

Marko Svaco


Eric_MUC

Excel and pictures....a few questions...
 
Hi Marco,

thx for the compliments - you're welcome.
Could you pls mark the answer as the answer to your question?

Thx in advance and best wishes,
Eric


"marko" wrote:

YOU ARE A GENIOUS!!!!!!!!!!!
IT WORKS PERFECTLY!!!!!
THANKS A MIOLLION!!!!!!

Marko Svaco




All times are GMT +1. The time now is 04:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com