Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How do I clear all cells from all rows except the first row in Sheet1?
|
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
here's one way, but change the "A" to whatever column has the last row of data
Sub test() Dim lastrow As Long lastrow = Cells(Rows.Count, "A").End(xlUp).Row Rows("2:" & lastrow).ClearContents End Sub -- Gary "Michael" wrote in message oups.com... How do I clear all cells from all rows except the first row in Sheet1? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Michael,
Here's one way. UsedRange allows for situations if you have blank rows above the header row. If this is never the case you can delete it. Private Sub CommandButton1_Click() With Worksheets("Sheet1").UsedRange .Range("A2", .Cells(.Rows.Count, .Columns.Count)).ClearContents End With End Sub NickHK "Michael" wrote in message oups.com... How do I clear all cells from all rows except the first row in Sheet1? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
As long as the used range doesn't include the last row of the worksheet:
Worksheets("Sheet1").UsedRange.Offset(1).ClearCont ents - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions http://PeltierTech.com _______ "Michael" wrote in message oups.com... How do I clear all cells from all rows except the first row in Sheet1? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Checking the Cells in Sheet1 with Cells in Sheet2 and replace | Excel Worksheet Functions | |||
Display Rows From Sheet1 In Sheet2 (Import) | Excel Worksheet Functions | |||
Need to copy rows in Sheet1 to different worksheets | Excel Programming | |||
Need to copy rows in Sheet1 to different worksheets | Excel Programming | |||
Need to copy rows in Sheet1 to different worksheets | Excel Programming |