View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
bill m bill m is offline
external usenet poster
 
Posts: 3
Default nothing is working yet

Hope I didn't confuse anyone out there. The code below is a portion of code
I put in to test what was happening. The original code selected on a range
and copied the selection to another area. It isn't that the code does not
work it just doesn't work all the time. Most of the time it executes without
a problem. Just seems like it disassociates from Excel at least in the
select function. No matter how I write the code to select it just doesn't. I
have tried all the codes from the previous responsed before. Thought for
sure that reactivating the worksheet was the solution but that also has no
effect. Heres the code as it stands right now.
========================================
Private Sub Radio_Buttons()
Application.EnableEvents = False
Application.ScreenUpdating = False

Excel.Sheets("InterActive Chart").Activate
Worksheets("INTERACTIVE CHART").Select

Range("A295:BF295").Value = ""
Application.Goto Reference:="DateRange"
Selection.Copy
Range("A295").Select
Selection.PasteSpecial Paste:=xlValues
========================================
When it gets to 'Selection.Copy' I get 'Copy method of Range class failed'.
The subroutine executed as least 5 times and then got this error. For some
reason the program is just not in control of the Excel worksheet.

Thanks to everyone for the replies.



"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.