View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jeff Wright[_2_] Jeff Wright[_2_] is offline
external usenet poster
 
Posts: 47
Default Deleting cells in a row

Thanks, William! This works just fine.

Appreciatively,

Jeff

"William" wrote in message
...
Hi Jeff

I thought you might say that! There is a difference between "delete" and
"clear". Try this...

Sub Test()
With ThisWorkbook.Sheets("Sheet1")
Application.Intersect(ActiveCell.EntireRow, _
.Range("B:E,H:M")).ClearContents
End With
End Sub

--

-----
XL2003
Regards

William




"Jeff Wright" wrote in message
news:Jlk8e.17342$lv1.13098@fed1read06...
William, this works fine except the macro moves the data from the cells
below up into the just-cleared cells. I don't want this. I just want to
leave the cells empty.

Thanks,

Jeff


"William" wrote in message
...
Hi Jeff

Assuming it is the cells in Columns B-E and Columns H-M of the currently
selected row that you want deleted, then try...

Sub Test()
With ThisWorkbook.Sheets("Sheet1")
Application.Intersect(ActiveCell.EntireRow, _
.Range("B:E,H:M")).Delete Shift:=xlUp
End With
End Sub

-----
XL2003
Regards

William




"Jeff Wright" wrote in message
news:93j8e.17010$lv1.10175@fed1read06...
I want to write a subroutine which will delete specific cells in a row.
For
example, if the active cell is A13, I want the macro to delete cells
B13
through E13, and also cells H13 through M13.

Your help is appreciated.

Jeff