T
TheMilkGuy
Hi folks,
Based on the show/hide pictures information I read here:
http://www.mcgimpsey.com/excel/lookuppics.html
I edited it to work for my scenario. The first part is included
because I'm not sure if it is contributing to the problem, as my VB
knowledge is less than nil.
I get the Runtime Error 13: Type Mismatch error. Could someone
please tell me how I can fix it?
At the same time, if there is a way to 'clean up' the code, I would
appreciate that too.
Many thanks!
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.HasFormula = False Then
Application.EnableEvents = False
Target.Value = UCase(Target.Value)
Application.EnableEvents = True
End If
End Sub
Private Sub Worksheet_Calculate()
Dim oPic As Picture
Me.Pictures.Visible = False
Me.Pictures("Picture 1").Visible = True
With Range("bo1")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO2")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO3")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO4")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO5")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO6")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO7")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO8")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO9")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO10")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO11")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO12")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO13")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO14")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO15")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO16")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO17")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO18")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO19")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
End Sub
Based on the show/hide pictures information I read here:
http://www.mcgimpsey.com/excel/lookuppics.html
I edited it to work for my scenario. The first part is included
because I'm not sure if it is contributing to the problem, as my VB
knowledge is less than nil.
I get the Runtime Error 13: Type Mismatch error. Could someone
please tell me how I can fix it?
At the same time, if there is a way to 'clean up' the code, I would
appreciate that too.
Many thanks!
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.HasFormula = False Then
Application.EnableEvents = False
Target.Value = UCase(Target.Value)
Application.EnableEvents = True
End If
End Sub
Private Sub Worksheet_Calculate()
Dim oPic As Picture
Me.Pictures.Visible = False
Me.Pictures("Picture 1").Visible = True
With Range("bo1")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO2")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO3")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO4")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO5")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO6")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO7")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO8")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO9")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO10")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO11")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO12")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO13")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO14")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO15")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO16")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO17")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO18")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
With Range("BO19")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = AK1
oPic.Left = .Left
Exit For
End If
Next oPic
End With
End Sub