Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default What's wrong with this code?

Hi to all!

I've inserted one image via Insert/image/from file.
I've created as well a button, this commandbutton has this code:

ActiveSheet.Shapes("Picture 1").Select
Selection.ShapeRange.Visible = False

and the image (of course) disappear.

With another commandbutton, I want this image to appear again, I've written
this code:

ActiveSheet.Shapes("Picture 1").Select
Selection.ShapeRange.Visible = True

This last code doesn't work, because there is not "picture 1" to select. How
can I make this image to appear again?

Thanks to all!!

--
atrep
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 367
Default What's wrong with this code?

You don't need to select it:

ActiveSheet.Shapes("Picture 1").Visible = False
ActiveSheet.Shapes("Picture 1").Visible = True

cheers
Carlo

On Jan 10, 5:34*pm, xavi garriga
wrote:
Hi to all!

I've inserted one image via Insert/image/from file.
I've created as well a button, this commandbutton has this code:

ActiveSheet.Shapes("Picture 1").Select
Selection.ShapeRange.Visible = False

and the image (of course) disappear.

With another commandbutton, I want this image to appear again, I've written
this code:

ActiveSheet.Shapes("Picture 1").Select
Selection.ShapeRange.Visible = True

This last code doesn't work, because there is not "picture 1" to select. How
can I make this image to appear again?

Thanks to all!!

--
atrep


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default What's wrong with this code?

There is no need to select, and no need for ShapeRange

ActiveSheet.Shapes("Picture 1").Visible = False

and

ActiveSheet.Shapes("Picture 1").Visible = True


But you can do it all with one commandbutton

With ActiveSheet.Shapes("Picture 1")
.Visible = Not .Visible
End With

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"xavi garriga" wrote in message
...
Hi to all!

I've inserted one image via Insert/image/from file.
I've created as well a button, this commandbutton has this code:

ActiveSheet.Shapes("Picture 1").Select
Selection.ShapeRange.Visible = False

and the image (of course) disappear.

With another commandbutton, I want this image to appear again, I've
written
this code:

ActiveSheet.Shapes("Picture 1").Select
Selection.ShapeRange.Visible = True

This last code doesn't work, because there is not "picture 1" to select.
How
can I make this image to appear again?

Thanks to all!!

--
atrep



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default What's wrong with this code?

Thank you!
--
atrep


"Bob Phillips" wrote:

There is no need to select, and no need for ShapeRange

ActiveSheet.Shapes("Picture 1").Visible = False

and

ActiveSheet.Shapes("Picture 1").Visible = True


But you can do it all with one commandbutton

With ActiveSheet.Shapes("Picture 1")
.Visible = Not .Visible
End With

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"xavi garriga" wrote in message
...
Hi to all!

I've inserted one image via Insert/image/from file.
I've created as well a button, this commandbutton has this code:

ActiveSheet.Shapes("Picture 1").Select
Selection.ShapeRange.Visible = False

and the image (of course) disappear.

With another commandbutton, I want this image to appear again, I've
written
this code:

ActiveSheet.Shapes("Picture 1").Select
Selection.ShapeRange.Visible = True

This last code doesn't work, because there is not "picture 1" to select.
How
can I make this image to appear again?

Thanks to all!!

--
atrep




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wrong code? GBH99 Excel Programming 3 September 12th 07 05:40 PM
what is wrong with this code? Nicole Seibert Excel Programming 3 March 16th 06 03:47 PM
What's wrong with this code? PhilipsBernard Excel Programming 4 October 20th 05 07:30 AM
What's wrong with this code??? Twain[_3_] Excel Programming 3 August 1st 05 03:02 PM
What's wrong w/my code? nrage21[_54_] Excel Programming 5 July 28th 04 03:50 PM


All times are GMT +1. The time now is 11:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"