PC Review


Reply
Thread Tools Rate Thread

delete row code to be modified very slightly??

 
 
Corey
Guest
Posts: n/a
 
      4th Dec 2006
~~~~~~~~~~~
Sub DeleteEvent()
If Not
Application.Intersect(Range("A28,A32,A36,A40,A44,A48,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


 
Reply With Quote
 
 
 
 
Ron de Bruin
Guest
Posts: n/a
 
      4th Dec 2006
Hi Corey

Change the cells in the range to the unlocked cells and use this in the code

ActiveCell.Offset(-1, 0).Resize(4)

With offset we go one row up before we resize

--

Regards Ron de Bruin
http://www.rondebruin.nl



"Corey" <(E-Mail Removed)> wrote in message
news:OGhWDy%(E-Mail Removed)...
> ~~~~~~~~~~~
> Sub DeleteEvent()
> If Not
> Application.Intersect(Range("A28,A32,A36,A40,A44,A48,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
>


 
Reply With Quote
 
=?Utf-8?B?Sm9obiBCdW5keQ==?=
Guest
Posts: n/a
 
      4th Dec 2006
Just offset the row one like this:

ActiveCell.Offset(-1, 1).Resize(4).EntireRow.Delete

John

"Corey" wrote:

> ~~~~~~~~~~~
> Sub DeleteEvent()
> If Not
> Application.Intersect(Range("A28,A32,A36,A40,A44,A48,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
>
>
>

 
Reply With Quote
 
Corey
Guest
Posts: n/a
 
      4th Dec 2006
Sub DeleteEvent()
If Not
Application.Intersect(Range("A28,A32,A36,A40,A44,A48,A52,A56,A60,A64,A68,A72,A76,A80,A84,A88,A92,A96,A90"),
ActiveCell) Is Nothing Then
' ActiveCell.Resize(4).EntireRow.Delete
ActiveCell.Offset(-1, 0).Resize(4).EntireRow.Delete ' <======= Is
that want you meant Ron ??

End If
End Sub

Ithe code does not seem to do anything now??

Corey....
"Ron de Bruin" <(E-Mail Removed)> wrote in message
news:ekNbR8%(E-Mail Removed)...
> Hi Corey
>
> Change the cells in the range to the unlocked cells and use this in the
> code
>
> ActiveCell.Offset(-1, 0).Resize(4)
>
> With offset we go one row up before we resize
>
> --
>
> Regards Ron de Bruin
> http://www.rondebruin.nl
>
>
>
> "Corey" <(E-Mail Removed)> wrote in message
> news:OGhWDy%(E-Mail Removed)...
>> ~~~~~~~~~~~
>> Sub DeleteEvent()
>> If Not
>> Application.Intersect(Range("A28,A32,A36,A40,A44,A48,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
>>

>



 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      4th Dec 2006
You must also change the range
> Application.Intersect(Range("A28,A32,A36,A40,A44,A48,A52,A56,A60,A64,.....................


A28 must be A29 now and A32 must be ? and........................

--

Regards Ron de Bruin
http://www.rondebruin.nl



"Corey" <(E-Mail Removed)> wrote in message
news:%23eXpNG$(E-Mail Removed)...
> Sub DeleteEvent()
> If Not
> Application.Intersect(Range("A28,A32,A36,A40,A44,A48,A52,A56,A60,A64,A68,A72,A76,A80,A84,A88,A92,A96,A90"),
> ActiveCell) Is Nothing Then
> ' ActiveCell.Resize(4).EntireRow.Delete
> ActiveCell.Offset(-1, 0).Resize(4).EntireRow.Delete ' <======= Is
> that want you meant Ron ??
>
> End If
> End Sub
>
> Ithe code does not seem to do anything now??
>
> Corey....
> "Ron de Bruin" <(E-Mail Removed)> wrote in message
> news:ekNbR8%(E-Mail Removed)...
>> Hi Corey
>>
>> Change the cells in the range to the unlocked cells and use this in the
>> code
>>
>> ActiveCell.Offset(-1, 0).Resize(4)
>>
>> With offset we go one row up before we resize
>>
>> --
>>
>> Regards Ron de Bruin
>> http://www.rondebruin.nl
>>
>>
>>
>> "Corey" <(E-Mail Removed)> wrote in message
>> news:OGhWDy%(E-Mail Removed)...
>>> ~~~~~~~~~~~
>>> Sub DeleteEvent()
>>> If Not
>>> Application.Intersect(Range("A28,A32,A36,A40,A44,A48,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
>>>

>>

>
>


 
Reply With Quote
 
Corey
Guest
Posts: n/a
 
      4th Dec 2006
After changing the ranges to suit,
I now get an error:
Delete method of range class failed.

And the :
ActiveCell.Offset(-1, 0).Resize(4).EntireRow.Delete
Is highlighted in the code??


Corey....
"Ron de Bruin" <(E-Mail Removed)> wrote in message
news:OYnuEL$(E-Mail Removed)...
> You must also change the range
>> Application.Intersect(Range("A28,A32,A36,A40,A44,A48,A52,A56,A60,A64,.....................

>
> A28 must be A29 now and A32 must be ? and........................
>
> --
>
> Regards Ron de Bruin
> http://www.rondebruin.nl
>
>
>
> "Corey" <(E-Mail Removed)> wrote in message
> news:%23eXpNG$(E-Mail Removed)...
>> Sub DeleteEvent()
>> If Not
>> Application.Intersect(Range("A28,A32,A36,A40,A44,A48,A52,A56,A60,A64,A68,A72,A76,A80,A84,A88,A92,A96,A90"),
>> ActiveCell) Is Nothing Then
>> ' ActiveCell.Resize(4).EntireRow.Delete
>> ActiveCell.Offset(-1, 0).Resize(4).EntireRow.Delete ' <======= Is
>> that want you meant Ron ??
>>
>> End If
>> End Sub
>>
>> Ithe code does not seem to do anything now??
>>
>> Corey....
>> "Ron de Bruin" <(E-Mail Removed)> wrote in message
>> news:ekNbR8%(E-Mail Removed)...
>>> Hi Corey
>>>
>>> Change the cells in the range to the unlocked cells and use this in the
>>> code
>>>
>>> ActiveCell.Offset(-1, 0).Resize(4)
>>>
>>> With offset we go one row up before we resize
>>>
>>> --
>>>
>>> Regards Ron de Bruin
>>> http://www.rondebruin.nl
>>>
>>>
>>>
>>> "Corey" <(E-Mail Removed)> wrote in message
>>> news:OGhWDy%(E-Mail Removed)...
>>>> ~~~~~~~~~~~
>>>> Sub DeleteEvent()
>>>> If Not
>>>> Application.Intersect(Range("A28,A32,A36,A40,A44,A48,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
>>>>
>>>

>>
>>

>



 
Reply With Quote
 
Corey
Guest
Posts: n/a
 
      4th Dec 2006
Never mind.
I had a called code to unprotect the sheet but i selected the wrong code
that was unprotecting the wrong shet.

Thanks for your assistance

Corey....

"Ron de Bruin" <(E-Mail Removed)> wrote in message
news:OYnuEL$(E-Mail Removed)...
> You must also change the range
>> Application.Intersect(Range("A28,A32,A36,A40,A44,A48,A52,A56,A60,A64,.....................

>
> A28 must be A29 now and A32 must be ? and........................
>
> --
>
> Regards Ron de Bruin
> http://www.rondebruin.nl
>
>
>
> "Corey" <(E-Mail Removed)> wrote in message
> news:%23eXpNG$(E-Mail Removed)...
>> Sub DeleteEvent()
>> If Not
>> Application.Intersect(Range("A28,A32,A36,A40,A44,A48,A52,A56,A60,A64,A68,A72,A76,A80,A84,A88,A92,A96,A90"),
>> ActiveCell) Is Nothing Then
>> ' ActiveCell.Resize(4).EntireRow.Delete
>> ActiveCell.Offset(-1, 0).Resize(4).EntireRow.Delete ' <======= Is
>> that want you meant Ron ??
>>
>> End If
>> End Sub
>>
>> Ithe code does not seem to do anything now??
>>
>> Corey....
>> "Ron de Bruin" <(E-Mail Removed)> wrote in message
>> news:ekNbR8%(E-Mail Removed)...
>>> Hi Corey
>>>
>>> Change the cells in the range to the unlocked cells and use this in the
>>> code
>>>
>>> ActiveCell.Offset(-1, 0).Resize(4)
>>>
>>> With offset we go one row up before we resize
>>>
>>> --
>>>
>>> Regards Ron de Bruin
>>> http://www.rondebruin.nl
>>>
>>>
>>>
>>> "Corey" <(E-Mail Removed)> wrote in message
>>> news:OGhWDy%(E-Mail Removed)...
>>>> ~~~~~~~~~~~
>>>> Sub DeleteEvent()
>>>> If Not
>>>> Application.Intersect(Range("A28,A32,A36,A40,A44,A48,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
>>>>
>>>

>>
>>

>



 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      4th Dec 2006
If you protect your sheet manual it is not possible to delete rows with
locked cells in it in 2002 and up
if you check the delete rows setting when you protect your sheet.

Your only way is to protect your sheet with code
Remove your sheet protection of "Sheet1" ?
Insert this in the thisworkbook module

Private Sub Workbook_Open()
With Worksheets("sheet1")
.EnableSelection = xlUnlockedCells
.Protect Password:="hi", userinterfaceonly:=True
End With
End Sub

Then save/close and reopen the file


--

Regards Ron de Bruin
http://www.rondebruin.nl



"Corey" <(E-Mail Removed)> wrote in message
news:OL1F8P$(E-Mail Removed)...
> After changing the ranges to suit,
> I now get an error:
> Delete method of range class failed.
>
> And the :
> ActiveCell.Offset(-1, 0).Resize(4).EntireRow.Delete
> Is highlighted in the code??
>
>
> Corey....
> "Ron de Bruin" <(E-Mail Removed)> wrote in message
> news:OYnuEL$(E-Mail Removed)...
>> You must also change the range
>>> Application.Intersect(Range("A28,A32,A36,A40,A44,A48,A52,A56,A60,A64,.....................

>>
>> A28 must be A29 now and A32 must be ? and........................
>>
>> --
>>
>> Regards Ron de Bruin
>> http://www.rondebruin.nl
>>
>>
>>
>> "Corey" <(E-Mail Removed)> wrote in message
>> news:%23eXpNG$(E-Mail Removed)...
>>> Sub DeleteEvent()
>>> If Not
>>> Application.Intersect(Range("A28,A32,A36,A40,A44,A48,A52,A56,A60,A64,A68,A72,A76,A80,A84,A88,A92,A96,A90"),
>>> ActiveCell) Is Nothing Then
>>> ' ActiveCell.Resize(4).EntireRow.Delete
>>> ActiveCell.Offset(-1, 0).Resize(4).EntireRow.Delete ' <======= Is
>>> that want you meant Ron ??
>>>
>>> End If
>>> End Sub
>>>
>>> Ithe code does not seem to do anything now??
>>>
>>> Corey....
>>> "Ron de Bruin" <(E-Mail Removed)> wrote in message
>>> news:ekNbR8%(E-Mail Removed)...
>>>> Hi Corey
>>>>
>>>> Change the cells in the range to the unlocked cells and use this in the
>>>> code
>>>>
>>>> ActiveCell.Offset(-1, 0).Resize(4)
>>>>
>>>> With offset we go one row up before we resize
>>>>
>>>> --
>>>>
>>>> Regards Ron de Bruin
>>>> http://www.rondebruin.nl
>>>>
>>>>
>>>>
>>>> "Corey" <(E-Mail Removed)> wrote in message
>>>> news:OGhWDy%(E-Mail Removed)...
>>>>> ~~~~~~~~~~~
>>>>> Sub DeleteEvent()
>>>>> If Not
>>>>> Application.Intersect(Range("A28,A32,A36,A40,A44,A48,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
>>>>>
>>>>
>>>
>>>

>>

>
>


 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      4th Dec 2006
See my reply for another way Corey


--

Regards Ron de Bruin
http://www.rondebruin.nl



"Corey" <(E-Mail Removed)> wrote in message
news:OHPwLT$(E-Mail Removed)...
> Never mind.
> I had a called code to unprotect the sheet but i selected the wrong code
> that was unprotecting the wrong shet.
>
> Thanks for your assistance
>
> Corey....
>
> "Ron de Bruin" <(E-Mail Removed)> wrote in message
> news:OYnuEL$(E-Mail Removed)...
>> You must also change the range
>>> Application.Intersect(Range("A28,A32,A36,A40,A44,A48,A52,A56,A60,A64,.....................

>>
>> A28 must be A29 now and A32 must be ? and........................
>>
>> --
>>
>> Regards Ron de Bruin
>> http://www.rondebruin.nl
>>
>>
>>
>> "Corey" <(E-Mail Removed)> wrote in message
>> news:%23eXpNG$(E-Mail Removed)...
>>> Sub DeleteEvent()
>>> If Not
>>> Application.Intersect(Range("A28,A32,A36,A40,A44,A48,A52,A56,A60,A64,A68,A72,A76,A80,A84,A88,A92,A96,A90"),
>>> ActiveCell) Is Nothing Then
>>> ' ActiveCell.Resize(4).EntireRow.Delete
>>> ActiveCell.Offset(-1, 0).Resize(4).EntireRow.Delete ' <======= Is
>>> that want you meant Ron ??
>>>
>>> End If
>>> End Sub
>>>
>>> Ithe code does not seem to do anything now??
>>>
>>> Corey....
>>> "Ron de Bruin" <(E-Mail Removed)> wrote in message
>>> news:ekNbR8%(E-Mail Removed)...
>>>> Hi Corey
>>>>
>>>> Change the cells in the range to the unlocked cells and use this in the
>>>> code
>>>>
>>>> ActiveCell.Offset(-1, 0).Resize(4)
>>>>
>>>> With offset we go one row up before we resize
>>>>
>>>> --
>>>>
>>>> Regards Ron de Bruin
>>>> http://www.rondebruin.nl
>>>>
>>>>
>>>>
>>>> "Corey" <(E-Mail Removed)> wrote in message
>>>> news:OGhWDy%(E-Mail Removed)...
>>>>> ~~~~~~~~~~~
>>>>> Sub DeleteEvent()
>>>>> If Not
>>>>> Application.Intersect(Range("A28,A32,A36,A40,A44,A48,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
>>>>>
>>>>
>>>
>>>

>>

>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Struggling with code modified to delete invalid rows.. jeremiah Microsoft Excel Programming 1 22nd Jul 2008 04:38 PM
Going slightly mad - Insert sql not working from code but does in Access? JamesB Microsoft C# .NET 6 5th Mar 2008 02:51 PM
Can't delete a record with this slightly modified code: Access 03 =?Utf-8?B?U1FMZGJh?= Microsoft Access VBA Modules 4 4th Apr 2007 06:34 PM
Can this code be modified to delete rows? jamesfc30@earthlink.net Microsoft Excel Programming 7 19th Aug 2006 11:58 AM
Help to alter code slightly novicevbaer Microsoft Excel Programming 4 22nd Nov 2004 08:12 PM


Features
 

Advertising
 

Newsgroups
 


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