Home |
Search |
Today's Posts |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Chart Help Please | Excel Discussion (Misc queries) | |||
Timeline Chart? | Charts and Charting in Excel | |||
Problem with xlusrgal.xls file | Charts and Charting in Excel | |||
Impedding/Overlaying Charts | Charts and Charting in Excel | |||
pivot table multi line chart | Charts and Charting in Excel |