What line is the 4th line?
If it's one of those worksheet("...").delete lines, that means that the
worksheet doesn't exist.
If I don't care if the worksheet exists before I try to delete it, I just ignore
the error:
on error resume next
> > > > Sheets("Analysis").Delete
> > > > Sheets("David").Delete
> > > > Sheets("Jackie").Delete
> > > > Sheets("Jenni").Delete
> > > > Sheets("Julio").Delete
> > > > Sheets("Tally").Delete
on error goto 0
pgarcia wrote:
>
> Hello Dave, Thanks for answering my question. It "bugs" out on 4th line.
>
> Thanks
>
> "Dave Peterson" wrote:
>
> > I'm not Jim, but if I were, I'd ask what line caused the error.
> >
> > If it's this area:
> > > > With Sheets("Analysis Stats")
> > > > Sheets("Analysis Graphs").Range("BetsyR1").Copy Desintation:=.Range("A1")
> > > > .Select
> >
> > Try correcting the spelling of Destination.
> >
> > pgarcia wrote:
> > >
> > > Sorry I took so long to write back.
> > >
> > > I get:
> > >
> > > Run-time error '1004':
> > > Application-defined or object-defined error
> > >
> > > Thanks
> > >
> > > "Jim Thomlinson" wrote:
> > >
> > > > Try this...
> > > >
> > > > Application.ScreenUpdating = False
> > > > Application.DisplayAlerts = False
> > > > Sheets("Analysis").Delete
> > > > Sheets("David").Delete
> > > > Sheets("Jackie").Delete
> > > > Sheets("Jenni").Delete
> > > > Sheets("Julio").Delete
> > > > Sheets("Tally").Delete
> > > > Sheets.Add
> > > > Sheets("Sheet1").Name = "Analysis Stats"
> > > > With Sheets("Analysis Stats")
> > > > Sheets("Analysis Graphs").Range("BetsyR1").Copy Desintation:=.Range("A1")
> > > > .Select
> > > > ActiveWindow.Zoom = 70
> > > > .Cells.Interior.ColorIndex = 2
> > > > .Range("A2").Select
> > > > .Move After:=Sheets(3)
> > > > End With
> > > > Sheets("Analysis Graphs").Delete
> > > > Application.DisplayAlerts = True
> > > >
> > > > --
> > > > HTH...
> > > >
> > > > Jim Thomlinson
> > > >
> > > >
> > > > "pgarcia" wrote:
> > > >
> > > > > Having a problem with the following. It errors out but I'm not sure why?
> > > > > Thanks
> > > > >
> > > > > FYI, the sheets that are beeing delete are hiden, so is "Analysis Graphs".
> > > > >
> > > > > Sheets("Betsy").Select
> > > > > Range("B5").Select
> > > > > Application.ScreenUpdating = False
> > > > > Application.DisplayAlerts = False
> > > > > Sheets("Analysis").Delete
> > > > > Sheets("David").Delete
> > > > > Sheets("Jackie").Delete
> > > > > Sheets("Jenni").Delete
> > > > > Sheets("Julio").Delete
> > > > > Sheets("Tally").Delete
> > > > > Sheets.Add
> > > > > Sheets("Sheet1").Select
> > > > > Sheets("Sheet1").Name = "Analysis Stats"
> > > > > Application.DisplayAlerts = True
> > > > > Sheets("Analysis Graphs").Select
> > > > > Range("BetsyR1").Select
> > > > > Selection.Copy
> > > > > Sheets("Analysis Stats").Select
> > > > > ActiveSheet.Paste
> > > > > ActiveWindow.Zoom = 70
> > > > > Cells.Select
> > > > > Selection.Interior.ColorIndex = 2
> > > > > Range("A2").Selec
> > > > > Sheets("Analysis Stats").Move After:=Sheets(3)
> > > > > Sheets("Analysis Graphs").Delete
> > > > > Application.DisplayAlerts = True
> >
> > --
> >
> > Dave Peterson
> >
--
Dave Peterson
|