I have a graph on a worksheet (Sheet1) and data associated with it.
There is a button called Data_btn to show or hide the data and this works by simply changing the colour of the font of the data to "hide" it. (Hiding the column entirely will make the graph show nothing, as expected).
This is my code stored in Sheet1:
The code works except it hangs for a few seconds on these lines (and then continues to the end):
What is the reason for the delay?
Could it be due to the size of the data (sometimes there are 30,000 rows)?
Thanks
There is a button called Data_btn to show or hide the data and this works by simply changing the colour of the font of the data to "hide" it. (Hiding the column entirely will make the graph show nothing, as expected).
This is my code stored in Sheet1:
Code:
Private Sub Data_btn_Click()
Application.ScreenUpdating = False
With Sheet1
Select Case Data_btn.Caption
Case "Show Data"
Range(.Columns(1), .Columns(2)).Font.ColorIndex = xlAutomatic
.Data_btn.Caption = "Hide Data"
Case Else
Range(.Columns(1), .Columns(2)).Font.ColorIndex = 2
.Data_btn.Caption = "Show Data"
End Select
End With
Set myworksheet = Nothing
Application.ScreenUpdating = True
Exit Sub
The code works except it hangs for a few seconds on these lines (and then continues to the end):
Code:
.Data_btn.Caption = "Hide Data"
.Data_btn.Caption = "Show Data"
What is the reason for the delay?
Could it be due to the size of the data (sometimes there are 30,000 rows)?
Thanks