Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Macro to delete specific rows above selected cell

Hello,

I am trying to write the following macro, but I can't seem to get it
right.
I've had a look around on the other posts but I cant find anything to
suit.

I am using Excel 2002.

The macro contains other elements which I have sucessfully programmed.
At this point in the macro, a specific cell has been selected, and I
need to delete two specific rows which are above this cell.

A practical example would be, supposing Cell A10 has been selected as
the selected cell, the macro must now delete Rows 7 and 8 only, leaving
Rows 1-6 and 9-10 as they are.

If anybody can assist with this it would be much appreciated.

Many thanks.

Richard.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Macro to delete specific rows above selected cell

one way if a10 is selected

ActiveCell.Offset(-3, 0).Resize(2, 1).EntireRow.Delete

--


Gary


wrote in message
oups.com...
Hello,

I am trying to write the following macro, but I can't seem to get it
right.
I've had a look around on the other posts but I cant find anything to
suit.

I am using Excel 2002.

The macro contains other elements which I have sucessfully programmed.
At this point in the macro, a specific cell has been selected, and I
need to delete two specific rows which are above this cell.

A practical example would be, supposing Cell A10 has been selected as
the selected cell, the macro must now delete Rows 7 and 8 only, leaving
Rows 1-6 and 9-10 as they are.

If anybody can assist with this it would be much appreciated.

Many thanks.

Richard.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Macro to delete specific rows above selected cell

Thank you both for your help on this, much appreciated.

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
In VBA, How to Refer to Cell In Specific Column But Selected Rows? PBJ Excel Discussion (Misc queries) 7 August 3rd 07 05:56 PM
Macro to delete rows containing specific data Slohcin New Users to Excel 2 December 20th 06 11:52 AM
delete all rows above a selected cell rroach[_4_] Excel Programming 2 June 13th 05 11:52 PM
Macro to delete specific rows Steve Excel Programming 12 October 1st 04 11:50 PM
Need a macro to delete selected rows RKettle Excel Programming 5 January 13th 04 05:29 PM


All times are GMT +1. The time now is 12:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"