PC Review


Reply
Thread Tools Rate Thread

Copy pasted name range

 
 
pgarcia
Guest
Posts: n/a
 
      1st Feb 2008
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
 
Reply With Quote
 
 
 
 
Jim Thomlinson
Guest
Posts: n/a
 
      1st Feb 2008
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

 
Reply With Quote
 
pgarcia
Guest
Posts: n/a
 
      15th Feb 2008
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

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      15th Feb 2008
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
 
Reply With Quote
 
pgarcia
Guest
Posts: n/a
 
      18th Feb 2008
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
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      18th Feb 2008
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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do i select the coordinates of the first column & last row in a pasted range Luc Microsoft Excel Programming 5 15th Dec 2009 07:34 PM
Copy Range and Assign a Defined Name to the Pasted Range sgltaylor Microsoft Excel Programming 3 5th Dec 2009 12:47 PM
How do I determine the Range that was pasted Mike Microsoft Excel Programming 3 31st Mar 2006 01:39 AM
Excel range truncates when Pasted as Picture to PPT & Word =?Utf-8?B?RmxveWQ=?= Microsoft Excel Misc 2 28th Jan 2005 04:21 AM
how do i edit the range of a linked excel object pasted into powe. =?Utf-8?B?Z2FyZjkwMA==?= Microsoft Powerpoint 6 17th Jan 2005 09:05 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:14 AM.