Compile error (1 Viewer)

sunshine076

Registered User.
Local time
Today, 12:27
Joined
Apr 6, 2009
Messages
160
Morning to everyone, I have a piece of code that I am modifying by adding a select case to it but it keeps giving me a compile error on .visible. What I am doing is trying to hide inactive pictures and only show the name of active person with their logo. Any suggestions would be greatly appreciated. Thanks.

Private Sub Worksheet_Calculate()
Dim oPic As Picture
Me.Pictures.Visible = True
tbt = Range("p4")
Select Case tbt
Case tbt = "Eugene"
me.picture 328.visible = True 'Errors here on .visible

oPic 329 = False
oPic 330 = False
oPic 331 = False
oPic 332 = False
oPic 327 = False
Case tbt = "Lane"
oPic 327 = False
oPic 328 = False
oPic 329 = True
oPic 330 = False
oPic 331 = False
oPic 332 = False
End Select
End Sub
 

vbaInet

AWF VIP
Local time
Today, 17:27
Joined
Jan 22, 2010
Messages
26,374
This should go in the Excel section of the forum, but here:

me.picture_328.visible = True

with the underscore.
 

sunshine076

Registered User.
Local time
Today, 12:27
Joined
Apr 6, 2009
Messages
160
Thanks VbaInet however, I have noticed that also it is allowing me to switch between names with the list it doesn't hide the pictures or show the correct one it stays on whatever one is on top of the pile. I have attached a copy of the file that I am presently working with. What it looks like it is doing is naming each case the same and not checking for an update

Here is the updated code:


Private Sub Worksheet_Calculate()
Dim oPic As Picture
Me.Pictures.Visible = True
Picture = Range("O3")
tbt = Range("P4")
Select Case tbt
Case tbt = "Eugene"
Me.Picture_327.Visible = False
Me.Picture_328.Visible = True
Me.Picture_329.Visible = False
Me.Picture_330.Visible = False
Me.Picture_331.Visible = False
Me.Picture_332.Visible = False
Case tbt = "Lane"
Me.Picture_327.Visible = False
Me.Picture_328.Visible = False
Me.Picture_329.Visible = True
Me.Picture_330.Visible = False
Me.Picture_331.Visible = False
Me.Picture_332.Visible = False
End Select
End Sub
 

Attachments

  • Mill_Tool_Sheet4c.xls
    560.5 KB · Views: 91

vbaInet

AWF VIP
Local time
Today, 17:27
Joined
Jan 22, 2010
Messages
26,374
If you move your thread to the Excel section of the forum (as it relates to Excel not Access) you would get more appropriate responses.
 

Users who are viewing this thread

Top Bottom