I would like to be able to change the image in an excel file based on the value that is generated from a form scroll bar.
Specifically, I have 100 images that I want to correspond to numbers 1-100 in a cell. I know how to display the value of the scroll bar on to a specific cell but I cannot make it so the image automatically updates as the values in scroll bar change.
I would like the minute I change from two adjacent values (e.g. 49 to 50) for the image to automatically refresh.
I have been trying to do this by loading the images from a folder on an active x image box with the following VBA code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target <> Range("A1") Then Exit Sub
Select Case Target
Case "#1": Image1.Picture = LoadPicture("c:\images\1.bmp")
Case "#2": Image1.Picture = LoadPicture("c:\images\2.bmp")
Case "#3": Image1.Picture = LoadPicture("c:\images\3.bmp")
End Select
End Sub
The images change when I manually type in and enter a new value in excel, but i would like the image to change as I scroll the scroll bar.
Any input would be greatly appreciated.
Bookmarks