PC Review


Reply
Thread Tools Rate Thread

delete row and 3 rows below by range selected

 
 
Corey
Guest
Posts: n/a
 
      28th Nov 2006
The below code does not work, but how can i get it carry out what it says?

Private Sub CommandButton13_Click()
With activeworksheet
Dim rng As Range
Set rng = Range("A28,A32,A36,A40,A44,A48,A52,A56,A60")
If ActiveCell = rng Then ' <=== If selected cell is in range above ??
..Row -.Row + 4 '<==== Then delete the ROW that the selected cell is in and
the 3 ROWS below it ALSO??
..Delete

End If
End With
End Sub

Corey....


 
Reply With Quote
 
 
 
 
Ron de Bruin
Guest
Posts: n/a
 
      28th Nov 2006
Try this

Sub test()
If Not Application.Intersect(Range("A28,A32,A36,A40,A44,A48,A52,A56,A60"), ActiveCell) Is Nothing Then
ActiveCell.Resize(4).EntireRow.Delete
End If
End Sub


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


"Corey" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> The below code does not work, but how can i get it carry out what it says?
>
> Private Sub CommandButton13_Click()
> With activeworksheet
> Dim rng As Range
> Set rng = Range("A28,A32,A36,A40,A44,A48,A52,A56,A60")
> If ActiveCell = rng Then ' <=== If selected cell is in range above ??
> .Row -.Row + 4 '<==== Then delete the ROW that the selected cell is in and
> the 3 ROWS below it ALSO??
> .Delete
>
> End If
> End With
> End Sub
>
> Corey....
>
>

 
Reply With Quote
 
Corey
Guest
Posts: n/a
 
      28th Nov 2006
will try it tomorrow.
Thanks for the reply Ron.
I have 100% confidence in you code.

Corey....
"Ron de Bruin" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Try this
>
> Sub test()
> If Not
> Application.Intersect(Range("A28,A32,A36,A40,A44,A48,A52,A56,A60"),
> ActiveCell) Is Nothing Then
> ActiveCell.Resize(4).EntireRow.Delete
> End If
> End Sub
>
>
> --
> Regards Ron de Bruin
> http://www.rondebruin.nl
>
>
> "Corey" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> The below code does not work, but how can i get it carry out what it
>> says?
>>
>> Private Sub CommandButton13_Click()
>> With activeworksheet
>> Dim rng As Range
>> Set rng = Range("A28,A32,A36,A40,A44,A48,A52,A56,A60")
>> If ActiveCell = rng Then ' <=== If selected cell is in range above ??
>> .Row -.Row + 4 '<==== Then delete the ROW that the selected cell is in
>> and the 3 ROWS below it ALSO??
>> .Delete
>>
>> End If
>> End With
>> End Sub
>>
>> Corey....



 
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
Sort by Rows for a selected range Rose Microsoft Excel Programming 2 1st Jul 2009 02:34 AM
Reading columns and rows in selected range guest Microsoft Excel Programming 2 15th Apr 2008 02:45 AM
Return Rows of Selected Range in a Pivot Magnivy Microsoft Excel Programming 4 28th Dec 2007 04:03 AM
Referring to a Range Based on Selected Rows =?Utf-8?B?U3ByaW5rcw==?= Microsoft Excel Programming 2 22nd Dec 2005 04:15 PM
Delete non-selected rows SparePersn Microsoft Excel Programming 2 21st Dec 2004 02:57 PM


Features
 

Advertising
 

Newsgroups
 


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