Get data and photo from a sheet to image control in another sheet

Alex Piotto

Board Regular
Joined
Jul 5, 2016
Messages
82
Office Version
  1. 2007
Platform
  1. Windows
Hi EXCELlent people!

I am working on a recipes workbook and I need to ask for your help in order to retrieve an image (shape) from a sheet and show it into another one.

I'll explain... I have a sheet with a "database" containing the name, category, author, ingredients, preparation, date inserted and a photo of each recipe.

I inserted all the data in the sheet via userform.

So I have a nice long list of recipes, one per row, with a photo for each recipe in the last column (column 7 or G).

I am already able to get all the values of each recipe in another sheet into textboxes, calling from a populated combobox dropdown list with the recipes names.

But I can't figure out how to get the right photo for each recipe when showing the data.....

Code:
Private Sub selectrecipe_Change()

Dim msn As String
Dim msnFound As Range
msn = selectrecipe
With Sheets("RECIPESDATABASE")
Set msnFound = .Columns(1).Find(What:=msn, LookIn:=xlValues, Lookat:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
Worksheets("Sheet1").author.Value = msnFound.Offset(, 2).Value
Worksheets("Sheet1").ingredients.Value = Replace(msnFound.Offset(, 3).Value, vbCrLf, "")
Worksheets("Sheet1").preparation.Value = Replace(msnFound.Offset(, 4).Value, vbCrLf, "")
Worksheets("Sheet1").dateinserted.Value = Format(msnFound.Offset(, 5).Value, "dd-mm-yy")

Worksheets("Sheet1").photorecipe.Picture = Worksheets("RECIPESDATABASE").Image1.Picture        'photorecipe is the name of the image control in sheet1

End With

End Sub

Until now I can only show the first photo.... how can I get the right picture for every recipe I'll call from the combobox?

Any help will be really appreciated.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Cross posted https://www.excelforum.com/excel-pr...age-control-in-another-sheet.html#post4861435

Cross-Posting
While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0
Sorry everybody!
Out of desperation I cross posted because nobody answered me and... well I thought I had the code working but at the last moment...it wasn't.
Tomorrow I'll have to deliver the recipe book but I will be unable to do it and I will have to live with the consequences.
Silly me... and now I am practically banned from receiving any help. My bad. Sorry again.
Anyway, I received no answer whatsoever from any forum... so hopefully Nobody got involved in wasting time with my problem. If yes I am even more sorry about it.
I did not think about the week-end as a quieter time... I work on vba expecially during the week-end otherwise I have no time during working days...
 
Upvote 0
Thank you mole999. I am reading the link page, and it is really interesting... but it does not seems to be useful now, in my case.

I built my code in a different way. Now is too late to change everything. Shame... But is good for future learning!

My photos as well as the data are all already in the "database" sheet.
The insert part in my userform works just fine.
The retrieval also works, with the exception of the image...

I thought that it was easier... like with the text data.... offset the position and go... but I tried with the line below and surely got an error (object doesn't support.........). And my brain freeze.

Code:
Worksheets("Sheet1").Image1.Picture = msnFound.Offset(, 6).Shapes.Picture

Anyway at this point I do not bother anymore. I have got less then 12 hours before... the X moment. Pronto!

Cross posting... what were I thinking!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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