close

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 SvacoHi 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 lt;gt; 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
quot;markoquot; wrote:

gt; Hi!
gt;
gt; Here is the problem. I work in excel and i have to insert some
gt; pictures(about 30-50 of them), lets say all pictures from a specific
gt; folder. so i go to insert -- picture -- from file. thats fine. All my
gt; pictures are the same dimension- 640x480 and when i put them in excel
gt; some are big and some are small! why is that?
gt;
gt; now i have a VB question. How can i select all of these pictures
gt; through VBA. i would like VBA to select all pictures on the active
gt; sheet, i know how to resize them.
gt;
gt; And the last question. Is there a way with VBA to take all pictures on
gt; a sheet and put them i rows and columns so that it looks nice, and
gt; align them. i would like 5 pictures to be in a row and if there are 40
gt; pictures there would be 8 rows, so that i can see them all and that
gt; they are aligned!
gt; sorry for my bad english!
gt; Thanks in advance for any help!
gt;
gt; Marko Svaco
gt;
gt;

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

Marko SvacoHi 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,
Ericquot;markoquot; wrote:

gt; YOU ARE A GENIOUS!!!!!!!!!!!
gt; IT WORKS PERFECTLY!!!!!
gt; THANKS A MIOLLION!!!!!!
gt;
gt; Marko Svaco
gt;
gt;

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()