aguskwzwqyi
New Member
- Joined
- Nov 7, 2013
- Messages
- 4
how to insert a picture from souce cell and store it to another cell and save with the document (not just a link) using vba userform
example
i have wrote code like this but give error object required btw im new at vba that code i write, i get it from searching trough internet.
the cell used for refference that image was like this.
and this is place i sore the animal pictures
example
in sheet1 cell b9 to b200 i have a name of an animal and i must store it in excell file in sheet2 cell a5, b5, a7 b7 and so on because i skip one cell for numbering (a6,b6 a8,b8 and so on) assuming i have the picture of that animal in folder "D:\OneDrive\Desktop\animal"
VBA Code:
Private Sub btn_set_Click()
Dim animal_folder As String
Dim animal_name As String
Dim animal As Pictures
Set wksheet = Sheet1
Set aktif_sheet = Worksheets("Sheet3")
Set animal_folder = "D:\OneDrive\Desktop\animal" & Sheet1(2, 9).End(xlUp).Rows.Value & ".jpg"
end_row = aktif_sheet.Cells(Rows.Count, 1).End(xlUp).Rows + 1
aktif_sheet.Cells(end_row, 2) = animal_folder
End Sub
i have wrote code like this but give error object required btw im new at vba that code i write, i get it from searching trough internet.
the cell used for refference that image was like this.
Book1 | ||||
---|---|---|---|---|
A | B | |||
5 | NO | ANIMAL NAME | ||
6 | 1 | |||
7 | 2 | |||
8 | 3 | |||
9 | 4 | |||
10 | 5 | |||
11 | 6 | |||
12 | 7 | |||
13 | 8 | |||
14 | 9 | |||
15 | 10 | |||
16 | 11 | |||
17 | 12 | |||
Sheet1 |
and this is place i sore the animal pictures
Cell Formulas | ||
---|---|---|
Range | Formula | |
A11,A19,A17,A15,A13 | A11 | =B9+1 |
B11,B19,B17,B15,B13 | B11 | =A11+1 |