I'm a youth hockey coach and I'm trying to make a workbook to help planning practices easier for everyone in the association. I'd like the user to be able to select a drill from a drop down menu and have a corresponding image display next to it that shows how the drill is run. One one sheet, I have created a lookup table that includes the drill name, a description and a name for the image I want displayed when that option is selected. On a second sheet, I created the drop down menu using the data validation function and a dynamic formula so if the lookup table is added on to, the options in the drop down are automatically updated.
The workbook should work by the user selecting an option from the drop down and the corresponding image name appearing in cell D3 (this works by using a simple VLOOKUP formula). I then have the following VBA code that runs whenever the sheet recalculates (i.e. drop down is changed).
When I first made the sheet I had items in the table and 4 pictures pasted into the sheet with the drop down and everything worked fine. I saved the workbook as a .xlsm. Now when I add more items to the lookup table and paste and name the pictures in the sheet with the drop down menu, the sheet will not show the new images when that drill is selected. The 4 original images work just fine, but not any of the new ones. The really strange thing is that when the following line of code runs at the start of the macro...![]()
Private Sub Worksheet_Calculate() Dim oPic As Picture Me.Pictures.Visible = False With Me.Range("D3") For Each oPic In Me.Pictures If oPic.Name = .Text Then oPic.Visible = True oPic.Top = .Top oPic.Left = .Left Exit For End If Next oPic End With End Sub
...all the picture disappear, even the new ones. So Excel knows they are in the Me.Pictures collection, but for some reason can't find their names.![]()
Me.Pictures.Visible = False
Thank you in advance for your help!
Bookmarks