Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 227
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default 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






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
Deleting all cells that appear more than once Johnny Excel Discussion (Misc queries) 5 November 2nd 07 05:03 PM
Deleting Cells or Rows of Cells Nelly Excel Discussion (Misc queries) 3 August 22nd 07 11:46 AM
deleting unused cells / getting rid of inactive cells Woody13 Excel Discussion (Misc queries) 3 January 26th 06 09:11 PM
Deleting cells within a row Pablo Excel Discussion (Misc queries) 1 July 11th 05 08:41 PM
Deleting Hyphens or Dashes from multiple cells without deleting the remaining content rmaloy Excel Programming 5 February 9th 04 01:59 AM


All times are GMT +1. The time now is 11:57 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"