Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default How to turn on Shapes conditionally?

Hi All,
Here is the scenario: (Excel 2003)
1) I have created 10 different shapes (Free Form 1 to 10)
2) If the value in H10 is equal to "Box" then I want the Free Form 1 appears
at P10:T15 location
3) If the value in H10 is equal to "Table" then I want the Free Form 2
appears at P10:T15 location
4) If the value in H10 is equal to "Ball" then I want the Free Form 3
appears at P10:T15 location and so on.
I want to have only one Free Form at a time.
How can I do this?
Thanks very much in advance for any comments.
DORI

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default How to turn on Shapes conditionally?

Start with JE McGimpsey's program:

http://www.mcgimpsey.com/excel/lookuppics.html

Is that something you can work with?

***********
Regards,
Ron

XL2002, WinXP-Pro


"DORI" wrote:

Hi All,
Here is the scenario: (Excel 2003)
1) I have created 10 different shapes (Free Form 1 to 10)
2) If the value in H10 is equal to "Box" then I want the Free Form 1 appears
at P10:T15 location
3) If the value in H10 is equal to "Table" then I want the Free Form 2
appears at P10:T15 location
4) If the value in H10 is equal to "Ball" then I want the Free Form 3
appears at P10:T15 location and so on.
I want to have only one Free Form at a time.
How can I do this?
Thanks very much in advance for any comments.
DORI

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default How to turn on Shapes conditionally?

Hi Ron,
Thanks for the link. I tried the sample but no success:
1) I have the list of my variable texts in H10
2) I have inserted 10 sample pictures to my worksheet to try your suggestion,
2) when I choose a text from drop-down menu in H10, the corresponding text
appears in P10 (for example: Picture 1) then, all 10 images disappear from my
worksheet.
3) I have also entered the VBA code, VLook formula in P10 and Offset formula
in H10 using Data Validitation. what did I do wrong?

2) I have my own designed shapes (objects) using Excel drawing tools. How
can I use them instead of pictures?
Thanks for the help,
DORI

"Ron Coderre" wrote:

Start with JE McGimpsey's program:

http://www.mcgimpsey.com/excel/lookuppics.html

Is that something you can work with?

***********
Regards,
Ron

XL2002, WinXP-Pro


"DORI" wrote:

Hi All,
Here is the scenario: (Excel 2003)
1) I have created 10 different shapes (Free Form 1 to 10)
2) If the value in H10 is equal to "Box" then I want the Free Form 1 appears
at P10:T15 location
3) If the value in H10 is equal to "Table" then I want the Free Form 2
appears at P10:T15 location
4) If the value in H10 is equal to "Ball" then I want the Free Form 3
appears at P10:T15 location and so on.
I want to have only one Free Form at a time.
How can I do this?
Thanks very much in advance for any comments.
DORI

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default How to turn on Shapes conditionally?

Hi DORI,

If these are the only shapes on your sheet it could be done like
this...

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Shp As Shape
For Each Shp In Me.Shapes
Shp.Visible = Range("H10").Value = Shp.Name
Next Shp
End Sub


Before you use the code, position them all where you want them to
appear.
When you type "Box" in H10 only the Box will be visible etc

Before the code will work the way you want you will have to change each
freeform's name. To do that select a freeform then type its new name in
the Name Box on the left side of the Formula Bar, then press Enter
(Don't forget this important press of Enter).
Repeat with each freeform until you have named them all according to
the names you will be typing in H10.
You could also use a data validation dropdown list on H10 to select the
name of the freeform to show.

If you have other shapes on the sheet that you don't want the code to
make invisible, then you will have to extend the code so that those
shapes are skipped. For example say there is a shape named Rectangle 1
that has to remain visible at all times then the code should be changed
to...

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Shp As Shape
For Each Shp In Me.Shapes
If Shp.Name < "Rectangle 1" Then
Shp.Visible = Range("H10").Value = Shp.Name
End If
Next Shp
End Sub

Ken Johnson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default How to turn on Shapes conditionally?

Hi Ken,
Thank you very vrey much for the VBA code. It worked great. It is amazing
how a simple code can have such an impressive result.
Thank you again,
DORI

"Ken Johnson" wrote:

Hi DORI,

If these are the only shapes on your sheet it could be done like
this...

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Shp As Shape
For Each Shp In Me.Shapes
Shp.Visible = Range("H10").Value = Shp.Name
Next Shp
End Sub


Before you use the code, position them all where you want them to
appear.
When you type "Box" in H10 only the Box will be visible etc

Before the code will work the way you want you will have to change each
freeform's name. To do that select a freeform then type its new name in
the Name Box on the left side of the Formula Bar, then press Enter
(Don't forget this important press of Enter).
Repeat with each freeform until you have named them all according to
the names you will be typing in H10.
You could also use a data validation dropdown list on H10 to select the
name of the freeform to show.

If you have other shapes on the sheet that you don't want the code to
make invisible, then you will have to extend the code so that those
shapes are skipped. For example say there is a shape named Rectangle 1
that has to remain visible at all times then the code should be changed
to...

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Shp As Shape
For Each Shp In Me.Shapes
If Shp.Name < "Rectangle 1" Then
Shp.Visible = Range("H10").Value = Shp.Name
End If
Next Shp
End Sub

Ken Johnson




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default How to turn on Shapes conditionally?

Hi Ken,
One more question.
Is it possible to create another conditional list to have a different set of
freeforms appear in another location without disappearing the freeforms in
the first location?
Thanks again,
DORI
"Ken Johnson" wrote:

Hi DORI,

If these are the only shapes on your sheet it could be done like
this...

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Shp As Shape
For Each Shp In Me.Shapes
Shp.Visible = Range("H10").Value = Shp.Name
Next Shp
End Sub


Before you use the code, position them all where you want them to
appear.
When you type "Box" in H10 only the Box will be visible etc

Before the code will work the way you want you will have to change each
freeform's name. To do that select a freeform then type its new name in
the Name Box on the left side of the Formula Bar, then press Enter
(Don't forget this important press of Enter).
Repeat with each freeform until you have named them all according to
the names you will be typing in H10.
You could also use a data validation dropdown list on H10 to select the
name of the freeform to show.

If you have other shapes on the sheet that you don't want the code to
make invisible, then you will have to extend the code so that those
shapes are skipped. For example say there is a shape named Rectangle 1
that has to remain visible at all times then the code should be changed
to...

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Shp As Shape
For Each Shp In Me.Shapes
If Shp.Name < "Rectangle 1" Then
Shp.Visible = Range("H10").Value = Shp.Name
End If
Next Shp
End Sub

Ken Johnson


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default How to turn on Shapes conditionally?

Hi DORI,

the simplest way is to have your other set of freeforms on a different
sheet. This way the code is the same, just on different sheets.
You will be able to view both sheets together by going WindowNew
Window, then going WindowArrange and choose vertical.

If this is not the way you want to go, then the code will be a bit
harder, so let me know before I try to do it for freeforms on the one
sheet.

Ken Johnson

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
excel document with shapes on it but the shapes do not print [email protected] Excel Worksheet Functions 2 October 22nd 09 06:17 PM
Conditionally format cell to turn red after lookup match Dan H. Excel Discussion (Misc queries) 5 July 25th 08 08:54 PM
Naming Auto Shapes and Creating new Shapes AL2000 Excel Discussion (Misc queries) 3 September 10th 07 04:12 AM
When drawing shapes in excel the shapes keep disappearing Tape Excel Discussion (Misc queries) 1 October 6th 06 04:23 PM
How can i get more 3D shapes for Auto shapes in excel? Ajey Excel Discussion (Misc queries) 0 March 3rd 05 09:53 AM


All times are GMT +1. The time now is 02:01 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"