Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 5
Default Automated show and hide chart

i am working on a spreadsheet that generates a grpah for me. sometime i dont
need that graph to show up in the spreadsheet rater a message instead of
graph.
is there any macro that can help me do that automatically. the message will
be triggered by a value in a cell and then should hide the graph and display
the message. at the moment i do the same manually. but i have to do it for
over 300 sheets so if i can automate it somehow that will help a lot.
any help.
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 235
Default Automated show and hide chart

You could try experimenting with these two examples:

The macro below will show and hide an embedded chart and message based on a
calculated value + or - 50 in cell B2.

Option Explicit

Private Sub Worksheet_Calculate()

Dim Msg As String
Dim Rng As Range

Msg = "my message"
Set Rng = ActiveSheet.Range("B3")

If ActiveSheet.Range("B2").Value 50 Then
Worksheets("Sheet1").Shapes("Chart 1").Visible = True
Rng.Value = " "
Else
Worksheets("Sheet1").Shapes("Chart 1").Visible = False
Rng.Value = Msg
End If

End Sub

This will do the same only with a direct input o cell B2.

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

Dim Msg As String
Dim Rng As Range

Msg = "my message"
Set Rng = ActiveSheet.Range("B3")

If Target.Address = ActiveSheet.Range("B2").Address Then
Application.EnableEvents = False
If Target.Value 50 Then
Worksheets("Sheet1").Shapes("Chart 1").Visible = True
Rng.Value = " "
Else
Worksheets("Sheet1").Shapes("Chart 1").Visible = False
Rng.Value = Msg
End If
Application.EnableEvents = True
End If

End Sub

--
John Mansfield
http://www.cellmatrix.net


"soma" wrote:

i am working on a spreadsheet that generates a grpah for me. sometime i dont
need that graph to show up in the spreadsheet rater a message instead of
graph.
is there any macro that can help me do that automatically. the message will
be triggered by a value in a cell and then should hide the graph and display
the message. at the moment i do the same manually. but i have to do it for
over 300 sheets so if i can automate it somehow that will help a lot.
any help.
Thanks

  #3   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 5
Default Automated show and hide chart

Thanks, let me try that. i will get back if i have more questions.
Regards,

"John Mansfield" wrote:

You could try experimenting with these two examples:

The macro below will show and hide an embedded chart and message based on a
calculated value + or - 50 in cell B2.

Option Explicit

Private Sub Worksheet_Calculate()

Dim Msg As String
Dim Rng As Range

Msg = "my message"
Set Rng = ActiveSheet.Range("B3")

If ActiveSheet.Range("B2").Value 50 Then
Worksheets("Sheet1").Shapes("Chart 1").Visible = True
Rng.Value = " "
Else
Worksheets("Sheet1").Shapes("Chart 1").Visible = False
Rng.Value = Msg
End If

End Sub

This will do the same only with a direct input o cell B2.

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

Dim Msg As String
Dim Rng As Range

Msg = "my message"
Set Rng = ActiveSheet.Range("B3")

If Target.Address = ActiveSheet.Range("B2").Address Then
Application.EnableEvents = False
If Target.Value 50 Then
Worksheets("Sheet1").Shapes("Chart 1").Visible = True
Rng.Value = " "
Else
Worksheets("Sheet1").Shapes("Chart 1").Visible = False
Rng.Value = Msg
End If
Application.EnableEvents = True
End If

End Sub

--
John Mansfield
http://www.cellmatrix.net


"soma" wrote:

i am working on a spreadsheet that generates a grpah for me. sometime i dont
need that graph to show up in the spreadsheet rater a message instead of
graph.
is there any macro that can help me do that automatically. the message will
be triggered by a value in a cell and then should hide the graph and display
the message. at the moment i do the same manually. but i have to do it for
over 300 sheets so if i can automate it somehow that will help a lot.
any help.
Thanks

  #4   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 5
Default Automated show and hide chart

Worked like a charm. just one more question is it possible to triger the
macro as soon as i change the value in the cell. for example if i use B3 50
(as per macro) it shoud automatically do what it suppose to do?
Thanks

"soma" wrote:

Thanks, let me try that. i will get back if i have more questions.
Regards,

"John Mansfield" wrote:

You could try experimenting with these two examples:

The macro below will show and hide an embedded chart and message based on a
calculated value + or - 50 in cell B2.

Option Explicit

Private Sub Worksheet_Calculate()

Dim Msg As String
Dim Rng As Range

Msg = "my message"
Set Rng = ActiveSheet.Range("B3")

If ActiveSheet.Range("B2").Value 50 Then
Worksheets("Sheet1").Shapes("Chart 1").Visible = True
Rng.Value = " "
Else
Worksheets("Sheet1").Shapes("Chart 1").Visible = False
Rng.Value = Msg
End If

End Sub

This will do the same only with a direct input o cell B2.

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

Dim Msg As String
Dim Rng As Range

Msg = "my message"
Set Rng = ActiveSheet.Range("B3")

If Target.Address = ActiveSheet.Range("B2").Address Then
Application.EnableEvents = False
If Target.Value 50 Then
Worksheets("Sheet1").Shapes("Chart 1").Visible = True
Rng.Value = " "
Else
Worksheets("Sheet1").Shapes("Chart 1").Visible = False
Rng.Value = Msg
End If
Application.EnableEvents = True
End If

End Sub

--
John Mansfield
http://www.cellmatrix.net


"soma" wrote:

i am working on a spreadsheet that generates a grpah for me. sometime i dont
need that graph to show up in the spreadsheet rater a message instead of
graph.
is there any macro that can help me do that automatically. the message will
be triggered by a value in a cell and then should hide the graph and display
the message. at the moment i do the same manually. but i have to do it for
over 300 sheets so if i can automate it somehow that will help a lot.
any help.
Thanks

  #5   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 235
Default Automated show and hide chart

Yes, both macros will trigger the instructions when the value of the cell
changes.
--
John Mansfield
http://www.cellmatrix.net


"soma" wrote:

Worked like a charm. just one more question is it possible to triger the
macro as soon as i change the value in the cell. for example if i use B3 50
(as per macro) it shoud automatically do what it suppose to do?
Thanks

"soma" wrote:

Thanks, let me try that. i will get back if i have more questions.
Regards,

"John Mansfield" wrote:

You could try experimenting with these two examples:

The macro below will show and hide an embedded chart and message based on a
calculated value + or - 50 in cell B2.

Option Explicit

Private Sub Worksheet_Calculate()

Dim Msg As String
Dim Rng As Range

Msg = "my message"
Set Rng = ActiveSheet.Range("B3")

If ActiveSheet.Range("B2").Value 50 Then
Worksheets("Sheet1").Shapes("Chart 1").Visible = True
Rng.Value = " "
Else
Worksheets("Sheet1").Shapes("Chart 1").Visible = False
Rng.Value = Msg
End If

End Sub

This will do the same only with a direct input o cell B2.

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

Dim Msg As String
Dim Rng As Range

Msg = "my message"
Set Rng = ActiveSheet.Range("B3")

If Target.Address = ActiveSheet.Range("B2").Address Then
Application.EnableEvents = False
If Target.Value 50 Then
Worksheets("Sheet1").Shapes("Chart 1").Visible = True
Rng.Value = " "
Else
Worksheets("Sheet1").Shapes("Chart 1").Visible = False
Rng.Value = Msg
End If
Application.EnableEvents = True
End If

End Sub

--
John Mansfield
http://www.cellmatrix.net


"soma" wrote:

i am working on a spreadsheet that generates a grpah for me. sometime i dont
need that graph to show up in the spreadsheet rater a message instead of
graph.
is there any macro that can help me do that automatically. the message will
be triggered by a value in a cell and then should hide the graph and display
the message. at the moment i do the same manually. but i have to do it for
over 300 sheets so if i can automate it somehow that will help a lot.
any help.
Thanks

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
Show and hide a embedded chart? Bob Charts and Charting in Excel 1 June 17th 09 05:12 AM
How can I show/hide plots in a chart? Two-bit Tony Charts and Charting in Excel 1 May 13th 09 11:15 AM
Want to Hide columns in spreadsheet but NOT hide data in chart. KrispyData Charts and Charting in Excel 1 March 20th 09 04:45 PM
Chart Legend Items: hide/show Richard Ahlvin Charts and Charting in Excel 5 September 5th 05 03:04 PM
hide column but show chart Svetlana Charts and Charting in Excel 1 January 14th 05 09:49 AM


All times are GMT +1. The time now is 10:54 PM.

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"