ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to disable chart tab in Excel? (https://www.excelbanter.com/excel-programming/379666-how-disable-chart-tab-excel.html)

Amit

how to disable chart tab in Excel?
 

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


Martin Fishlock

how to disable chart tab in Excel?
 
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




All times are GMT +1. The time now is 08:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com