Hello everyone,
I am new to VBA!
Any help will be greatly appreciated.
I have a sheet named NCR Form, in cell A9 i have a dropdown data validation list, when i pick from the data validation list pre-determined cells are automatically populated, also within this sheet are 6 picture boxes,
What i want from these 6 picture boxes is when i pick from the Data Validation List the picture boxes automatically populate, the pictures can vary from 1 to 6.
I can do this now using a control button with the following code that i have managed to get from this wonderful site, however I have to have 6 pictures for each one in the list
Sub ReplaceImages()
If Range("A9") = "" Then Exit Sub
Dim MyPic As String
For i = 1 To 6
MyPic = "C:\Output\" & Range("A9").Value & "_" & i & ".jpg"
With Me.Shapes("Pic_" & i).Fill
.Visible = msoTrue
On Error Resume Next
.UserPicture MyPic
End With
Next i
End Sub
Private Sub CommandButton1_Click()
ReplaceImages
End Sub
The picture boxes are named Pic_1 to Pic_6
The pictures are located in C:\Output\ and are named NCR 00001_1, NCR 00001_2 etc
What i desire is to get rid of the command button and have the code that will automatically populate the picture boxes using the Dropdown Data Validation List, the number of pictures will vary from 1 to 6, and have them the same size.
Any help will be greatly appreciated!
Thank You
Rob
Bookmarks