LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 276
Default delete row code to be modified very slightly??

~~~~~~~~~~~
Sub DeleteEvent()
If Not
Application.Intersect(Range("A28,A32,A36,A40,A44,A 48,A52,A56,A60,A64,A68,A72,A76,A80,A84,A88,A92,A96 ,A90"),
ActiveCell) Is Nothing Then
ActiveCell.Resize(4).EntireRow.Delete
End If
End Sub
~~~~~~~~~~~

The above code works great for my needs as it deletes the highlighted row
and the 3 rows below it also(4 in total).
But as i have now found once i protect the sheet i need to not allow that
row being selected anymore,
but instead i need the code to work if a cell is selected, rather than the
row. BUT the cell will be 1 row lower than the needed 1st row to be deleted.

EG.

Previously i would highlight row 28, and when i click a commandbutton to run
the code,
rows 28-31(4 rows) would be deleted.
Now that the sheet is protected the user cannot select the row to highlight
the 1st row to be deleted.
I now need the cell A29 to be selected(which is not locked) then when the
user runs the code from the commandbutton,
the above row and the folowing 3 rows(4 in total) will be deleted.


The rows can be anywhere in the sheet from 28-240(in lots of 4 rows when
deleted)

Can some help me to adjust this code to suit that?

ctm


 
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
Can this code be modified to delete rows? [email protected] Excel Programming 7 August 19th 06 11:58 AM
Code that can't be seen/modified by users Wescotte Excel Programming 1 June 21st 05 05:29 PM
Determine if cell was modified by Enter , Paste or Delete Randy Excel Programming 3 April 30th 05 04:17 PM
Help to alter code slightly novicevbaer[_13_] Excel Programming 4 November 22nd 04 08:12 PM
Modified VB Code for Converting Number to Text shashidharga[_3_] Excel Programming 4 October 3rd 04 01:11 PM


All times are GMT +1. The time now is 06:55 PM.

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"