Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
delete all rows above a selected cell
I have a macro that selects a specific (and different in each worksheet) cell based on cell contents. From that cell location (it is the activated cell at current step of macro) I want to highlight and delete all rows in the worksheet above to the top of the worksheet. I'm stuck. Any ideas? -- rroach ------------------------------------------------------------------------ rroach's Profile: http://www.excelforum.com/member.php...o&userid=21093 View this thread: http://www.excelforum.com/showthread...hreadid=378687 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
delete all rows above a selected cell
Sub DeleteAbove()
Dim rng As Range On Error Resume Next Set rng = ActiveCell.Offset(-1, 0) On Error GoTo 0 If Not rng Is Nothing Then _ Range("A1", ActiveCell.Offset(-1, 0)).EntireRow.Delete End Sub -- HTH... Jim Thomlinson "rroach" wrote: I have a macro that selects a specific (and different in each worksheet) cell based on cell contents. From that cell location (it is the activated cell at current step of macro) I want to highlight and delete all rows in the worksheet above to the top of the worksheet. I'm stuck. Any ideas? -- rroach ------------------------------------------------------------------------ rroach's Profile: http://www.excelforum.com/member.php...o&userid=21093 View this thread: http://www.excelforum.com/showthread...hreadid=378687 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
delete all rows above a selected cell
If no blank cells above the active cell........
Sub SelectUp() Range(ActiveCell, ActiveCell.End(xlUp)).EntireRow.Delete End Sub Otherwise..... Sub SelectUp() Range(ActiveCell, Range("A1")).EntireRow.Delete End Sub Gord Dibben Excel MVP On Mon, 13 Jun 2005 16:11:27 -0500, rroach wrote: I have a macro that selects a specific (and different in each worksheet) cell based on cell contents. From that cell location (it is the activated cell at current step of macro) I want to highlight and delete all rows in the worksheet above to the top of the worksheet. I'm stuck. Any ideas? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Delete selected rows data | Excel Programming | |||
Delete non-selected rows | Excel Programming | |||
Delete Selected Rows | Excel Programming | |||
Need a macro to delete selected rows | Excel Programming | |||
Delete/Collapse Rows Not Selected | Excel Programming |