BrianExcel
Well-known Member
- Joined
- Apr 21, 2010
- Messages
- 975
Right now I am employing the following code.
What this code does is basically display a different image each time the slider bar is moved.
What I need to do however, is display 2 images simultaneously using the slider.
In the first frame I have img0 - img5. In the second frame img6 - img11.
When I select the first tick on the slider, I need img0 and img6 both to show. The second tick shows img2 and img7, and so on.
Any thoughts on how I manipulate the code so it shows two variables? I would like to keep the code as minimal and simple as possible.
Code:
Sub sldrStaple_Scroll()
Dim sValue As Integer
sValue = Me.sldrStaple.Value
With UserForm1.MultiPage1.Pages(3)
ShowImageStaple "img" & sValue
End With
End Sub
Sub ShowImageStaplePort(whichOneStaple As String)
Dim objImage As Image, objImage2 As Image
Dim cntl As Control
For Each cntl In Me.frmStapling.Controls
If Left(cntl.Name, 3) = "img" Then
cntl.Visible = False
End If
Next cntl
Set objImage = Me.Controls(whichOneStaple)
objImage.Visible = True
Set objImage = Nothing
End Sub
What this code does is basically display a different image each time the slider bar is moved.
What I need to do however, is display 2 images simultaneously using the slider.
In the first frame I have img0 - img5. In the second frame img6 - img11.
When I select the first tick on the slider, I need img0 and img6 both to show. The second tick shows img2 and img7, and so on.
Any thoughts on how I manipulate the code so it shows two variables? I would like to keep the code as minimal and simple as possible.