View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Getting VBE to recognize a new sheet

quartz,

Usually, it is solved by starting off with something like

On Error Resume Next
Application.DisplayAlerts = False
Worksheets("REPORT").Delete
.....
'code to add the new REPORT sheet
.......
Application.DisplayAlerts = True

HTH,
Bernie
MS Excel MVP

"quartz" wrote in message
...
Hello, HELP!

Each time my program runs, it replaces an existing "REPORT" sheet

with a new one. The program then writes VBA into the newly created
sheet module. This program runs fine the first time (i.e. when there
is no pre-existing "REPORT" sheet).

If there is a pre-existing "REPORT" sheet, the program explodes (and

I am in the blast radius).

The problem is, I think, that the portion of the program that writes

the code into the module sheet does not yet see or recognize that the
new "REPORT" sheet exists yet (even though it actually does).

How can I overcome this situation and make it see the new sheet on

the fly?

Thanks in advance.