Struggling with VBA

mxg14

New Member
Joined
Jul 14, 2015
Messages
1
Hi guys,

Im struggling to create a VBA to find and resize pictures in my Excel.

Im looking for help as no one in my team seems to have any VBA skills.
I hope one of you will be able to help me.

You can find below my code.



Private Sub CommandButton1_Click()


Dim i As Integer
i = 7 (as the first cell i want it to woek with is in the lign 7)

Do While Worksheets("SKU List").Cells(i, 1) <> "" (i want the macro to work until there is nothing anymore in collumn A)

Cells (Worksheets("SKU List").Cells(i, 10)) (I want the photo to be insert in collumn J)

country = Left(Worksheets("SKU List").Cells(i, 1), 2)
sku = Worksheets("SKU List").Cells(i, 9)

Dim path_files As String

path_files = "http://america.& country/i/" & country & "-" & sku & "-1-catalog.jpg"


Sheets("SKU List").Shapes.AddPicture path_files _
, msoTrue, msoTrue, 30, 2080 + (i - 2) * 120, 100, 100
Loop

End Sub


Thnaks in advance,


Best,


Max
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Hi Max,

Below is something i have used in the past - you may need to amend slightly for what you need.

<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit;">Sub PicReSize()
Dim MySht As Worksheet
Dim MyPic As Shape
Dim MyLeft As Single, MyTop As Single

' position in Pixel relative to top/left of sheet
MyTop
= 50
MyLeft
= 50

' alternatively position to the top/left of
#VALUE!
#VALUE!
 
Upvote 0

Forum statistics

Threads
1,217,337
Messages
6,135,969
Members
449,974
Latest member
riffburn

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