Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 390
Default Erase Data on Sheet

How can I erase all the cells after row 1 on a worksheet when the sheet opens.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Erase Data on Sheet

Private Sub Workbook_Open()
Dim ToErase As Range, EraseRows As Integer

Set ToErase = Sheets("SheetName").UsedRange
EraseRows = ToErase.Rows.Count - 1
If EraseRows 0 Then
Set ToErase = ToErase.Offset(1, 0).Range("1:" & EraseRows)
ToErase.ClearContents
End If

End Sub

"Bill" wrote:

How can I erase all the cells after row 1 on a worksheet when the sheet opens.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Erase Data on Sheet

Bill

You sure you want to do this?

Private Sub Worksheet_Activate()
Range("A2:IV65536").ClearContents
End Sub


Gord Dibben Excel MVP

On Tue, 25 Jan 2005 14:25:03 -0800, "Bill"
wrote:

How can I erase all the cells after row 1 on a worksheet when the sheet opens.


Reply
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
save workbook, erase data but keep formula denvancam Excel Discussion (Misc queries) 4 May 18th 11 10:31 PM
why do print range erase in Excel when import data from access MaryD Excel Worksheet Functions 1 February 17th 10 08:23 PM
want to erase the 0 Darrell_Sarrasin via OfficeKB.com Excel Discussion (Misc queries) 4 September 16th 08 03:24 PM
"how to erase data save on excel Mario New Users to Excel 1 September 15th 07 05:02 AM
VB to erase 2 Columns from every sheet Kevin M Excel Worksheet Functions 2 December 1st 04 09:42 PM


All times are GMT +1. The time now is 06:50 AM.

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

About Us

"It's about Microsoft Excel"