ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Run-Time Error: You must select a shape (https://www.excelbanter.com/excel-worksheet-functions/9844-run-time-error-you-must-select-shape.html)

Lee

Run-Time Error: You must select a shape
 
I received a Microsoft Visual Basic Error at run-time which read "You must
select a shape". It was a warning prompt and it did not highlight a line of
code when I attempted to debug.

When the prompt is cleared the code continues to run. However, the problem
is that the code stops.

My Excel VBA code is performing a copy of worksheets from one workbook to
another.

After examining the workbook where the problem appeared to occur, I
discovered that a chart in the workbook had the focus or was left selected by
a user. There is also a pivot table on the same worksheet as the chart.

When I remove the focus from the chart, by selecting a cell on the
worksheet, the error is no longer produced.

Is this a bug, or designed behavior?

Don Guillett

you could make something like this as your first line.
ActiveSheet.ChartObjects("chart 1").Chart.Deselect

--
Don Guillett
SalesAid Software

"Lee" wrote in message
...
I received a Microsoft Visual Basic Error at run-time which read "You must
select a shape". It was a warning prompt and it did not highlight a line

of
code when I attempted to debug.

When the prompt is cleared the code continues to run. However, the

problem
is that the code stops.

My Excel VBA code is performing a copy of worksheets from one workbook to
another.

After examining the workbook where the problem appeared to occur, I
discovered that a chart in the workbook had the focus or was left selected

by
a user. There is also a pivot table on the same worksheet as the chart.

When I remove the focus from the chart, by selecting a cell on the
worksheet, the error is no longer produced.

Is this a bug, or designed behavior?





All times are GMT +1. The time now is 10:03 PM.

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