Code to change picture in a spreadsheet not working

jrisebo

Active Member
Joined
Mar 15, 2011
Messages
319
Office Version
  1. 365
Platform
  1. Windows
I have a spreadsheet, when you pull down a menu, you can select two options that will change a picture in a spreadsheet. It was working, but now I get a error thats "Compile Error, cant find project or library"

Heres the code. not sure what to do.

Private Sub Worksheet_Calculate()
HideSignals
Select Case [h1]
Case 1: Shapes("OSERIES1").Visible = msoTrue
Case 2: Shapes("BSERIES1").Visible = msoTrue
End Select
Select Case [h1]
Case 1: Shapes("OSERIES2").Visible = msoTrue
Case 2: Shapes("BSERIES2").Visible = msoTrue
End Select
Select Case [h1]
Case 1: Shapes("OSERIES3").Visible = msoTrue
Case 2: Shapes("BSERIES3").Visible = msoTrue
End Select
Select Case [h1]
Case 1: Shapes("OSERIES4").Visible = msoTrue
Case 2: Shapes("BSERIES4").Visible = msoTrue
End Select
Select Case [h1]
Case 1: Shapes("OSERIES5").Visible = msoTrue
Case 2: Shapes("BSERIES5").Visible = msoTrue
End Select
Select Case [h1]
Case 1: Shapes("OSERIES6").Visible = msoTrue
Case 2: Shapes("BSERIES6").Visible = msoTrue
End Select
Select Case [h1]
Case 1: Shapes("OSERIES7").Visible = msoTrue
Case 2: Shapes("BSERIES7").Visible = msoTrue
End Select
End Sub

Sub HideSignals()
Dim i As Integer
For i = 1 To 7
Shapes("OSERIES" & i).Visible = msoFalse
Shapes("BSERIES" & i).Visible = msoFalse
Next i
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, [H2]) Is Nothing Then
'this does not calculate the worksheet. It just calls the Calculate event.
Worksheet_Calculate
End If
End Sub
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Private Sub Worksheet_Calculate() is the first, highlighted yellow

Select Case [h1]
highlighted blue
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top