Excel VBA - how to make an shape in excel appear and disappear?

rohaizad77

New Member
Joined
Apr 21, 2010
Messages
2
Hi,

I am using excel 2007, I created a shape from Excel (Insert-Shapes). I want this shape to appear and disappear base on some values but as a first step, I cant even get the visible property to work.

I created a button and in the click event, i do this code.

With ActiveSheet.Shapes("UpArrow3")
.Visible = Not .Visible
End With


I got an error that says....

"The item with the specified name wasn't found." - highlighted the 1st line.

Seems like excel cannot find UpArrow3 - so how do I make sure the shape that i add is called UpArrow3 - how to view its properties????

THanks in advance!!!!
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Your statement should be:

.Visible = msoTrue or .Visible = msoFalse

I don't know why, but intellisense doesn't work with just "ActiveSheet". If you do the following intellisense will be enabled and you will at least get a hint of what the proper syntax is:

Code:
Dim oActive As Worksheet
 
Set oActive = ActiveSheet
 
oActive.Shapes("UpArrow3").Visible = msoFalse

Gary
 
Upvote 0

Forum statistics

Threads
1,216,025
Messages
6,128,339
Members
449,443
Latest member
Chrissy_M

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