I am running a wintimer which I want a picture to update based on the value in textbox1.
Currently I am using the following but surely there is an eaiser script.
I would like to get rid of the if statements and have a simple formula like
the following (which of course doesn't work.
.
Currently I am using the following but surely there is an eaiser script.
Code:
If UserForm1.TextBox1.Value = "1" Then
UserForm1.Image1.Picture = UserForm1.Image2.Picture
UserForm1.TextBox1.Value = "2"
Exit Sub
End If
If UserForm1.TextBox1.Value = "2" Then
UserForm1.Image1.Picture = UserForm1.Image3.Picture
UserForm1.TextBox1.Value = "3"
Exit Sub
End If
If UserForm1.TextBox1.Value = "3" Then
UserForm1.Image1.Picture = UserForm1.Image4.Picture
UserForm1.TextBox1.Value = "4"
Exit Sub
End If
If UserForm1.TextBox1.Value = "4" Then
UserForm1.Image1.Picture = UserForm1.Image5.Picture
UserForm1.TextBox1.Value = "5"
Exit Sub
End If
If UserForm1.TextBox1.Value = "5" Then
UserForm1.Image1.Picture = UserForm1.Image6.Picture
UserForm1.TextBox1.Value = "6"
Exit Sub
End If
If UserForm1.TextBox1.Value = "6" Then
UserForm1.Image1.Picture = UserForm1.Image7.Picture
UserForm1.TextBox1.Value = "7"
Exit Sub
End If
If UserForm1.TextBox1.Value = "7" Then
UserForm1.Image1.Picture = UserForm1.Image8.Picture
UserForm1.TextBox1.Value = "8"
Exit Sub
End If
If UserForm1.TextBox1.Value = "8" Then
UserForm1.Image1.Picture = UserForm1.Image9.Picture
UserForm1.TextBox1.Value = "9"
Exit Sub
End If
If UserForm1.TextBox1.Value = "9" Then
UserForm1.Image1.Picture = UserForm1.Image10.Picture
UserForm1.TextBox1.Value = "10"
Exit Sub
End If
If UserForm1.TextBox1.Value = "10" Then
UserForm1.Image1.Picture = UserForm1.Image11.Picture
UserForm1.TextBox1.Value = "11"
Exit Sub
End If
If UserForm1.TextBox1.Value = "11" Then
UserForm1.Image1.Picture = UserForm1.Image12.Picture
UserForm1.TextBox1.Value = "12"
Exit Sub
End If
If UserForm1.TextBox1.Value = "12" Then
UserForm1.Image1.Picture = UserForm1.Image13.Picture
UserForm1.TextBox1.Value = "13"
Exit Sub
End If
If UserForm1.TextBox1.Value = "13" Then
UserForm1.Image1.Picture = UserForm1.Image14.Picture
UserForm1.TextBox1.Value = "14"
Exit Sub
End If
If UserForm1.TextBox1.Value = "14" Then
UserForm1.Image1.Picture = UserForm1.Image15.Picture
UserForm1.TextBox1.Value = "15"
Exit Sub
End If
If UserForm1.TextBox1.Value = "15" Then
UserForm1.Image1.Picture = UserForm1.Image16.Picture
UserForm1.TextBox1.Value = "16"
Exit Sub
End If
If UserForm1.TextBox1.Value = "16" Then
UserForm1.Image1.Picture = UserForm1.Image17.Picture
UserForm1.TextBox1.Value = "17"
Exit Sub
End If
If UserForm1.TextBox1.Value = "17" Then
UserForm1.Image1.Picture = UserForm1.Image18.Picture
UserForm1.TextBox1.Value = "18"
Exit Sub
End If
If UserForm1.TextBox1.Value = "18" Then
UserForm1.Image1.Picture = UserForm1.Image19.Picture
UserForm1.TextBox1.Value = "19"
Exit Sub
End If
If UserForm1.TextBox1.Value = "19" Then
UserForm1.Image1.Picture = UserForm1.Image20.Picture
UserForm1.TextBox1.Value = "20"
Exit Sub
End If
If UserForm1.TextBox1.Value = "20" Then
UserForm1.Image1.Picture = UserForm1.Image21.Picture
UserForm1.TextBox1.Value = "21"
Exit Sub
End If
If UserForm1.TextBox1.Value = "21" Then
UserForm1.Image1.Picture = UserForm1.Image22.Picture
UserForm1.TextBox1.Value = "22"
Exit Sub
End If
If UserForm1.TextBox1.Value = "22" Then
UserForm1.Image1.Picture = UserForm1.Image23.Picture
UserForm1.TextBox1.Value = "23"
Exit Sub
End If
If UserForm1.TextBox1.Value = "23" Then
UserForm1.Image1.Picture = UserForm1.Image24.Picture
UserForm1.TextBox1.Value = "24"
Exit Sub
End If
If UserForm1.TextBox1.Value = "24" Then
UserForm1.Image1.Picture = UserForm1.Image25.Picture
UserForm1.TextBox1.Value = "25"
Exit Sub
End If
If UserForm1.TextBox1.Value = "25" Then
UserForm1.Image1.Picture = UserForm1.Image2.Picture
UserForm1.TextBox1.Value = "1"
Exit Sub
End If
I would like to get rid of the if statements and have a simple formula like
the following (which of course doesn't work.
Code:
userform1.image1.picture = userform1.image & (userform1.textbox1.value).picture
.