VBA Can't select cell - what's up
I'm not sure about charts but to select a range on a worksheet that
worksheet must be the selected worksheet. Assuming the same rule applies
for charts then "Chart 52" is selected when you are trying to select a range
on "InterActive Chart."
To avoid this problem change your code to read.
Excel.ActiveSheet.ChartObjects("Chart 52").Select
Excel.Sheets("InterActive Chart").Range("D2").Value = "X3"
Excel.Sheets("InterActive Chart").Select
Excel.Sheets("InterActive Chart").Range("D2").Select
Or, if possible"
With Excel.Sheets("InterActive Chart")
.Select
.Range("D2").Select
End With
--
My handle should tell you enough about me. I am not an MVP, expert, guru,
etc. but I do like to help.
"bill m" wrote in message
...
Here's the code. It's within a subroutine which is called from serveral
other subroutines. I do a bit of EnableEvents and ScreenUpdating commands
in
my code for various reasons. Most of the time this code works. But some
condition seems to exist that stops the 'range("D2").Select' from
executing
properly. Haven't seen this before and I do have quite a lot of code in
Macros in many other Excel applictions.
=============================================
Excel.ActiveSheet.ChartObjects("Chart 52").Activate
Excel.ActiveSheet.ChartObjects("Chart 52").Select
Excel.Sheets("InterActive Chart").Range("D2").Value = "X3"
Excel.Sheets("InterActive Chart").Range("D2").Select
===============================================
The first 3 lines work properly, but I have no idea what Excel or VBA is
doing when I execute line 4. It does nothing, and I don't know where the
cursor is.
Any suggestions would be welcome.
|