[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.excel.programming

how to disable chart tab in Excel?

Amit

12/19/2006 2:28:00 AM


Hello all,

I'm have an active sheet with data in it. Also, there is a chart1 tab
which let user to see the graph of calculated data. How can I enable
and disable the chart tab in lower-left part of the screen?
It must be disable as long as the sheet is not puplated with data.

Thanks,
amit

1 Answer

Martin Fishlock

12/19/2006 4:19:00 AM

0

Amit.

Try this on the code for the worksheet where the datatable is.

Change the constants at the start of the code for your requirments.

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
'assume data table in A2:B4
Const cszRange As String = "A2:B4"
Const cszChart As String = "Chart1"

Dim rCells As Range
Dim lCellsNr As Long

Set rCells = Me.Range(cszRange)
lCellsNr = rCells.Cells.Count

If Not (Intersect(Target, rCells) Is Nothing) Then
Charts(cszChart).Visible = _
WorksheetFunction.CountBlank(rCells) <> lCellsNr
End If
Set rCells = Nothing ' not really needed but better here.
End Sub


--
Hope this helps
Martin Fishlock
Please do not forget to rate this reply.


"Amit" wrote:

>
> Hello all,
>
> I'm have an active sheet with data in it. Also, there is a chart1 tab
> which let user to see the graph of calculated data. How can I enable
> and disable the chart tab in lower-left part of the screen?
> It must be disable as long as the sheet is not puplated with data.
>
> Thanks,
> amit
>
>