Image controled by VB tools

  • Thread starter Thread starter jorlypong
  • Start date Start date
J

jorlypong

How do I turn on and off the visibility of an image using a radio button or
check box? My problem is in having VB locate the image. How do I name the
image so I may then refernce it in VB?
 
Hi,

With an image in the spreadsheet and the cursor in a cell, turn on the Macro
Recorder and select the image, then turn off the recorder and view your code.
This will tell you what the object name currently is, then add the following
code to the Sheet1 object (or whatever sheet your object is on). This is
done in the VBE by double-clicking the sheet name in the top left corner of
the screen.

Private Sub CheckBox1_Click()
If Me.CheckBox1 = True Then
ActiveSheet.Shapes("Picture 12").Visible = True
Else
ActiveSheet.Shapes("Picture 12").Visible = False
End If
End Sub
 
That was my first thought but the macro never recognized my picture or shape
(code in VB was blank for those actions). When looking at the properties of
the worksheet it only shows the worksheet itself and my checkbox; therefore,
I can't command it because I don't know the pictures name. Any other ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top