Cells.Clear
Or another way:
Sub test()
Dim MyRng As Range
Set MyRng = Application.InputBox(Prompt:="Select the range you wish to
keep", _
Title:="Keep Range", Type:=8)
Application.DisplayAlerts = False
Application.ScreenUpdating = False
MyRng.Copy
Sheets.Add.Name = "Temp"
Sheets("Temp").Range("A1").PasteSpecial (xlPasteAll)
Sheets("Sheet1").Cells.ClearContents
Sheets("Temp").UsedRange.Copy
Sheets("Sheet1").Activate
MyRng.PasteSpecial (xlPasteAll)
Sheets("Temp").Delete
Range("A1").Activate
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Mike F
"Abdul" wrote in message
...
Hi,
Worksheets("Sheet1").Cells.Clear
will clear the sheet.
If there a way that we can clear Cells less defined range?
some thing like Cells excluding "MyRange" .clear? so that t will be so
fast and without using loop
thanks
|