Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting cells in a row
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting cells in a row
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting cells in a row
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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Deleting all cells that appear more than once | Excel Discussion (Misc queries) | |||
Deleting Cells or Rows of Cells | Excel Discussion (Misc queries) | |||
deleting unused cells / getting rid of inactive cells | Excel Discussion (Misc queries) | |||
Deleting cells within a row | Excel Discussion (Misc queries) | |||
Deleting Hyphens or Dashes from multiple cells without deleting the remaining content | Excel Programming |