LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Selection after copy sheet failed

After copying a sheet, I cannot select a cell anymore and I cannot figure out
why. My Sub starts as follows :

Private Sub Worksheet_Change(ByVal Target As Range)

Application.ScreenUpdating = False

If Target.Address = "$N$30" And Range("Year").Value <
Range("LastYear").Value Then

Dim NewYear As VbMsgBoxResult
Dim TabName As String

NewYear = MsgBox("Save a copy?", vbYesNoCancel)

If NewYear= vbCancel Then
Range("Year").Value = Range("LastYear").Value
Range("$N$30").Select
Exit Sub
ElseIf NewYear= vbYes Then
TabName = "Archive " & Range("LastYear").Value
Sheets("Current year").Select
Sheets("Current year").Copy after:=Sheets("Current year")
Sheets("Current year (2)").Name = TabName
Range("A1:AI53").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues
Rows("54:500").Select
Selection.Delete
End If

The line : Range("A1:AI53").Select

Causes error :

Run-time error '1004':
Select method of Range class failed

Anyone any idea?

Thanks in advance,

Henk


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Selection copy and insert to other sheet (Macro) VLOOKUP fORMULA Excel Discussion (Misc queries) 8 March 27th 10 02:48 PM
Selection copy and insert to other sheet VLOOKUP fORMULA Excel Discussion (Misc queries) 1 March 23rd 10 05:29 PM
Selection.Copy on Temporarily unhidden excel sheet - possible bug? Joshua Excel Programming 1 November 7th 07 10:38 PM
Copy Selection to new sheet James Excel Programming 3 April 22nd 04 03:48 AM
Selection Failed Fernando Ortiz Excel Programming 2 February 24th 04 04:32 PM


All times are GMT +1. The time now is 03:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"