#1   Report Post  
daniel chen
 
Posts: n/a
Default De-activate a chart

My workbook contains charts.
If I had one of these charts activated, I could not execute Macros.
Please help me with a VBA code to de-activate them.


  #2   Report Post  
Hank Scorpio
 
Posts: n/a
Default

On Sun, 24 Apr 2005 00:34:44 GMT, "daniel chen"
wrote:

My workbook contains charts.
If I had one of these charts activated, I could not execute Macros.
Please help me with a VBA code to de-activate them.


Regardless of whether the chart is in a chartsheet or on a worksheet,
this should point you in the right direction:

Sub DeselectChart()

'Select any non-chart sheet
Sheet1.Select

'Or if the chart's on the current sheet, this'll do it.
Range("A1").Select

End Sub


---------------------------------------------------------
Hank Scorpio
scorpionet who hates spam is at iprimus.com.au (You know what to do.)
* Please keep all replies in this Newsgroup. Thanks! *
  #3   Report Post  
daniel chen
 
Posts: n/a
Default

Hi Hank,
I need to enter data in the worksheet that contains the activated chart.

"Hank Scorpio" wrote in message
...
On Sun, 24 Apr 2005 00:34:44 GMT, "daniel chen"
wrote:

My workbook contains charts.
If I had one of these charts activated, I could not execute Macros.
Please help me with a VBA code to de-activate them.


Regardless of whether the chart is in a chartsheet or on a worksheet,
this should point you in the right direction:

Sub DeselectChart()

'Select any non-chart sheet
Sheet1.Select

'Or if the chart's on the current sheet, this'll do it.
Range("A1").Select

End Sub


---------------------------------------------------------
Hank Scorpio
scorpionet who hates spam is at iprimus.com.au (You know what to do.)
* Please keep all replies in this Newsgroup. Thanks! *



  #4   Report Post  
Hank Scorpio
 
Posts: n/a
Default

On Sun, 24 Apr 2005 01:57:46 GMT, "daniel chen"
wrote:

Hi Hank,
I need to enter data in the worksheet that contains the activated chart.


Yesssss... and?

All you do is specify the range that you want to enter the data into,
and use the .Select method as originally illustrated.

(In fact you don't even need to specify the exact range if the macro
itself is doing the entry; all you need to do is use the .Select
method on a range... ANY range or cell... which will make the
worksheet rather than the chart active. You can then do your data
entry.)

"Hank Scorpio" wrote in message
.. .
On Sun, 24 Apr 2005 00:34:44 GMT, "daniel chen"
wrote:

My workbook contains charts.
If I had one of these charts activated, I could not execute Macros.
Please help me with a VBA code to de-activate them.


Regardless of whether the chart is in a chartsheet or on a worksheet,
this should point you in the right direction:

Sub DeselectChart()

'Select any non-chart sheet
Sheet1.Select

'Or if the chart's on the current sheet, this'll do it.
Range("A1").Select

End Sub


---------------------------------------------------------
Hank Scorpio
scorpionet who hates spam is at iprimus.com.au (You know what to do.)
* Please keep all replies in this Newsgroup. Thanks! *
  #5   Report Post  
daniel chen
 
Posts: n/a
Default

Hi Hank,
You are right.
I just found out something that I didn't see the difference.
Please explain. Thanks,

Sub Macro1()
Sheets("abc").Select
Range("A1").Select ' This one works
' Cells(1, 1).Select ' This one doesn't work, if a chart is
activated.
End Sub

"Hank Scorpio" wrote in message
...
On Sun, 24 Apr 2005 01:57:46 GMT, "daniel chen"
wrote:

Hi Hank,
I need to enter data in the worksheet that contains the activated chart.


Yesssss... and?

All you do is specify the range that you want to enter the data into,
and use the .Select method as originally illustrated.

(In fact you don't even need to specify the exact range if the macro
itself is doing the entry; all you need to do is use the .Select
method on a range... ANY range or cell... which will make the
worksheet rather than the chart active. You can then do your data
entry.)

"Hank Scorpio" wrote in message
. ..
On Sun, 24 Apr 2005 00:34:44 GMT, "daniel chen"
wrote:

My workbook contains charts.
If I had one of these charts activated, I could not execute Macros.
Please help me with a VBA code to de-activate them.

Regardless of whether the chart is in a chartsheet or on a worksheet,
this should point you in the right direction:

Sub DeselectChart()

'Select any non-chart sheet
Sheet1.Select

'Or if the chart's on the current sheet, this'll do it.
Range("A1").Select

End Sub


---------------------------------------------------------
Hank Scorpio
scorpionet who hates spam is at iprimus.com.au (You know what to do.)
* Please keep all replies in this Newsgroup. Thanks! *





  #6   Report Post  
Hank Scorpio
 
Posts: n/a
Default

On Sun, 24 Apr 2005 02:49:26 GMT, "daniel chen"
wrote:

Hi Hank,
You are right.
I just found out something that I didn't see the difference.
Please explain. Thanks,

Sub Macro1()
Sheets("abc").Select
Range("A1").Select ' This one works
' Cells(1, 1).Select ' This one doesn't work, if a chart is
activated.
End Sub


The following is from on-line help on the Range property, and explains
why it doesn't need a qualifying object. (Typically the qualifying
object would be a reference to the worksheet that the range is on):
---------------------------
"When used without an object qualifier, this property is a shortcut
for ActiveSheet.Range (it returns a range from the active sheet; if
the active sheet isn’t a worksheet, the property fails)."
------------------------------

The Cells property is less forgiving. Thus you would need to qualify
it as (for example) :

'Only if abc is the current sheet!
'Otherwise, add the line
'Worksheets("abc").Select
'first.

Worksheets("abc").Cells(1, 1).Select

"Hank Scorpio" wrote in message
.. .
On Sun, 24 Apr 2005 01:57:46 GMT, "daniel chen"
wrote:

Hi Hank,
I need to enter data in the worksheet that contains the activated chart.


Yesssss... and?

All you do is specify the range that you want to enter the data into,
and use the .Select method as originally illustrated.

(In fact you don't even need to specify the exact range if the macro
itself is doing the entry; all you need to do is use the .Select
method on a range... ANY range or cell... which will make the
worksheet rather than the chart active. You can then do your data
entry.)

"Hank Scorpio" wrote in message
...
On Sun, 24 Apr 2005 00:34:44 GMT, "daniel chen"
wrote:

My workbook contains charts.
If I had one of these charts activated, I could not execute Macros.
Please help me with a VBA code to de-activate them.

Regardless of whether the chart is in a chartsheet or on a worksheet,
this should point you in the right direction:

Sub DeselectChart()

'Select any non-chart sheet
Sheet1.Select

'Or if the chart's on the current sheet, this'll do it.
Range("A1").Select

End Sub



---------------------------------------------------------
Hank Scorpio
scorpionet who hates spam is at iprimus.com.au (You know what to do.)
* Please keep all replies in this Newsgroup. Thanks! *
  #7   Report Post  
daniel chen
 
Posts: n/a
Default

Hi Hank,
Thank you very much.
Nicely explained.

"Hank Scorpio" wrote in message
...
On Sun, 24 Apr 2005 02:49:26 GMT, "daniel chen"
wrote:

Hi Hank,
You are right.
I just found out something that I didn't see the difference.
Please explain. Thanks,

Sub Macro1()
Sheets("abc").Select
Range("A1").Select ' This one works
' Cells(1, 1).Select ' This one doesn't work, if a chart
is
activated.
End Sub


The following is from on-line help on the Range property, and explains
why it doesn't need a qualifying object. (Typically the qualifying
object would be a reference to the worksheet that the range is on):
---------------------------
"When used without an object qualifier, this property is a shortcut
for ActiveSheet.Range (it returns a range from the active sheet; if
the active sheet isn't a worksheet, the property fails)."
------------------------------

The Cells property is less forgiving. Thus you would need to qualify
it as (for example) :

'Only if abc is the current sheet!
'Otherwise, add the line
'Worksheets("abc").Select
'first.

Worksheets("abc").Cells(1, 1).Select

"Hank Scorpio" wrote in message
. ..
On Sun, 24 Apr 2005 01:57:46 GMT, "daniel chen"
wrote:

Hi Hank,
I need to enter data in the worksheet that contains the activated chart.

Yesssss... and?

All you do is specify the range that you want to enter the data into,
and use the .Select method as originally illustrated.

(In fact you don't even need to specify the exact range if the macro
itself is doing the entry; all you need to do is use the .Select
method on a range... ANY range or cell... which will make the
worksheet rather than the chart active. You can then do your data
entry.)

"Hank Scorpio" wrote in message
m...
On Sun, 24 Apr 2005 00:34:44 GMT, "daniel chen"
wrote:

My workbook contains charts.
If I had one of these charts activated, I could not execute Macros.
Please help me with a VBA code to de-activate them.

Regardless of whether the chart is in a chartsheet or on a worksheet,
this should point you in the right direction:

Sub DeselectChart()

'Select any non-chart sheet
Sheet1.Select

'Or if the chart's on the current sheet, this'll do it.
Range("A1").Select

End Sub



---------------------------------------------------------
Hank Scorpio
scorpionet who hates spam is at iprimus.com.au (You know what to do.)
* Please keep all replies in this Newsgroup. 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
Chart Help Please Alex Excel Discussion (Misc queries) 2 April 8th 05 06:57 PM
Timeline Chart? ckrogers Charts and Charting in Excel 3 March 17th 05 09:20 PM
Problem with xlusrgal.xls file Alfred S C Lee Charts and Charting in Excel 2 December 29th 04 05:54 PM
Impedding/Overlaying Charts Phil Hageman Charts and Charting in Excel 4 December 17th 04 07:25 PM
pivot table multi line chart souris Charts and Charting in Excel 2 December 7th 04 03:56 AM


All times are GMT +1. The time now is 02:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"