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

Alex Piotto

New Member
Joined
Jul 5, 2016
Messages
10
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.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
32,270
Office Version
365
Platform
Windows
Cross posted https://www.excelforum.com/excel-programming-vba-macros/1223493-get-image-shape-from-a-sheet-to-image-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.
 

Alex Piotto

New Member
Joined
Jul 5, 2016
Messages
10
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...
 

Alex Piotto

New Member
Joined
Jul 5, 2016
Messages
10
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!
 

Forum statistics

Threads
1,082,143
Messages
5,363,378
Members
400,732
Latest member
robcooper2001

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top