View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Duncan[_5_] Duncan[_5_] is offline
external usenet poster
 
Posts: 290
Default Data may exist in the sheet(s) message

Try this...

Sub CopyCells()
Application.displayalerts = false
Range("A1:I15").Select
Selection.Copy
Sheets.Add
ActiveSheet.Paste
Sheets(1).Select
Sheets(1).Name = "LeaveRequest"
Cells.Select
Application.CutCopyMode = False
With Selection.Interior
.ColorIndex = 2
.PatternColorIndex = xlAutomatic
End With
ActiveWindow.DisplayHeadings = False
Sheets("LeaveRequested").Select
ActiveWindow.SelectedSheets.Delete
Range("l9").Select
Application.displayalerts = true
End Sub

Duncan


cedtech23 wrote:

How do I stop excel from give this message by answer for my users?

"Data may exist in the sheet(s) selection for deletion. To permanently
delete the date, Press Delete"


my code is

Code:
--------------------

Sub CopyCells()

Range("A1:I15").Select
Selection.Copy
Sheets.Add
ActiveSheet.Paste
Sheets(1).Select
Sheets(1).Name = "LeaveRequest"
Cells.Select
Application.CutCopyMode = False
With Selection.Interior
.ColorIndex = 2
.PatternColorIndex = xlAutomatic
End With
ActiveWindow.DisplayHeadings = False
Sheets("LeaveRequested").Select
ActiveWindow.SelectedSheets.Delete
Range("l9").Select
End Sub

--------------------


--
cedtech23
------------------------------------------------------------------------
cedtech23's Profile: http://www.excelforum.com/member.php...o&userid=31022
View this thread: http://www.excelforum.com/showthread...hreadid=563680