#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default Delete rows

I'm writing a macro to allow users to delete rows from the sheet. All they
have to do is select a cell in the table and press a shortcut. The entire row
where this cell is located will then be deleted. However, i want to prevent
them from deleting any rows below the last row in the table.
Because the table changes all the time (eg new rows get added), the row
number for the last row is a variable. to go around this, i gave the first
cell in the last row a name "Bottom". So how can i check that the cell
selected by the user (in the row they want to delete) is not situated below
"Bottom"?

The last row in my table has a different pattern and colour (to give a
visual indication that the table ends there).

Many thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Delete rows

On 11 May, 07:49, Tendresse
wrote:
I'm writing a macro to allow users to delete rows from the sheet. All they
have to do is select a cell in the table and press a shortcut. The entire row
where this cell is located will then be deleted. However, i want to prevent
them from deleting any rows below the last row in the table.
Because the table changes all the time (eg new rows get added), the row
number for the last row is a variable. to go around this, i gave the first
cell in the last row a name "Bottom". So how can i check that the cell
selected by the user (in the row they want to delete) is not situated below
"Bottom"?

The last row in my table has a different pattern and colour (to give a
visual indication that the table ends there).

Many thanks in advance


try something like:-

if activecell.row = range("namedcell").row then
msgbox "Doh!"
exit sub
end if

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
Hpw do I delete multiple empty rows found between filled rows? Bill Excel Worksheet Functions 2 November 15th 09 07:12 PM
Cut filtered rows, paste into next empty row of new sheet, and delete cut rows Scott Excel Worksheet Functions 0 December 13th 06 01:25 AM
Delete rows with numeric values, leave rows with text GSpline Excel Programming 5 October 11th 05 12:44 AM
How to delete rows when List toolbar's "delete" isnt highlighted? Linda Excel Worksheet Functions 1 May 26th 05 08:39 PM
Delete every 3rd row, then delete rows 2-7, move info f/every 2nd row up one to the end and delete the row below Annette[_4_] Excel Programming 2 September 21st 04 02:40 PM


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