Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have the following lines:
Dim chtDiagra As Chart Set chtDiagra = ActiveChart How do I check if chtDiagra is empty. That will happne if no chart is selected, when the code is run. Jan |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Put your relevant code inside an If...Then statement:
If Not chtDiagra Is Nothing Then 'code to do something here End If The code will only execute if chtDiagra has value, otherwise it goes on to the next executable line. "Jan Kronsell" wrote in message ... I have the following lines: Dim chtDiagra As Chart Set chtDiagra = ActiveChart How do I check if chtDiagra is empty. That will happne if no chart is selected, when the code is run. Jan |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you.
It tried that, but used IsEmpty, not IsNothing :-) Jan JLGWhiz wrote: Put your relevant code inside an If...Then statement: If Not chtDiagra Is Nothing Then 'code to do something here End If The code will only execute if chtDiagra has value, otherwise it goes on to the next executable line. "Jan Kronsell" wrote in message ... I have the following lines: Dim chtDiagra As Chart Set chtDiagra = ActiveChart How do I check if chtDiagra is empty. That will happne if no chart is selected, when the code is run. Jan |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The syntax is not correct. I don't work with charts in VBA very often, so I
would have to look up the syntax for getting to the chart object via code, but the priciple is to check for the object type that is selected to make sure it is a chart of some kind. Check in the charting news group, someone there probably has it handy. "Jan Kronsell" wrote in message ... Thank you. It tried that, but used IsEmpty, not IsNothing :-) Jan JLGWhiz wrote: Put your relevant code inside an If...Then statement: If Not chtDiagra Is Nothing Then 'code to do something here End If The code will only execute if chtDiagra has value, otherwise it goes on to the next executable line. "Jan Kronsell" wrote in message ... I have the following lines: Dim chtDiagra As Chart Set chtDiagra = ActiveChart How do I check if chtDiagra is empty. That will happne if no chart is selected, when the code is run. Jan |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you.
I actually ended up making an On error routine grabbing the returned error , if a chart is not selected. Jan JLGWhiz wrote: The syntax is not correct. I don't work with charts in VBA very often, so I would have to look up the syntax for getting to the chart object via code, but the priciple is to check for the object type that is selected to make sure it is a chart of some kind. Check in the charting news group, someone there probably has it handy. "Jan Kronsell" wrote in message ... Thank you. It tried that, but used IsEmpty, not IsNothing :-) Jan JLGWhiz wrote: Put your relevant code inside an If...Then statement: If Not chtDiagra Is Nothing Then 'code to do something here End If The code will only execute if chtDiagra has value, otherwise it goes on to the next executable line. "Jan Kronsell" wrote in message ... I have the following lines: Dim chtDiagra As Chart Set chtDiagra = ActiveChart How do I check if chtDiagra is empty. That will happne if no chart is selected, when the code is run. Jan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Nothing Keyword Destories Objects rather than just resetting the variable to an empty variable | Excel Programming | |||
Chart empty with new data in the dynamic range chart. | Excel Discussion (Misc queries) | |||
array variable is empty? | Excel Programming | |||
If Range Variable isn't Empty | Excel Programming | |||
empty variable range | Excel Discussion (Misc queries) |