PC Review


Reply
Thread Tools Rate Thread

deleting multiple rows

 
 
nerohnze
Guest
Posts: n/a
 
      21st Dec 2007
Hi,
I need to delete subsequent rows, but i have to address the starting and the
end points by referring two cells.

I mean i dont want to use this:
Rows("2:5").Delete
But use this(something like this):
?? Rows( & Cells(1,2):Cells(1,3) & ).Delete ??

Can you please help? I couldn't find something like that in help pages.

 
Reply With Quote
 
 
 
 
sebastienm
Guest
Posts: n/a
 
      21st Dec 2007
Hi,
try something like:
Range(Cells(1,2) , Cells(1,3) ).EntireRow.Delete
--
Regards,
Sébastien
<http://www.ondemandanalysis.com>
<http://www.ready-reports.com>


"nerohnze" wrote:

> Hi,
> I need to delete subsequent rows, but i have to address the starting and the
> end points by referring two cells.
>
> I mean i dont want to use this:
> Rows("2:5").Delete
> But use this(something like this):
> ?? Rows( & Cells(1,2):Cells(1,3) & ).Delete ??
>
> Can you please help? I couldn't find something like that in help pages.
>

 
Reply With Quote
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      21st Dec 2007
I'm guessing you are looking for something like this...

Range(Cells(2, 1).Row & ":" & Cells(5, 1).Row).Delete

Note that your original Cell references were both using Row 1 (1st argument
in Cells) and changing the Column (2nd argument in Cells); the above
reverses them so the correct rows are being deleted.

Rick


"nerohnze" <(E-Mail Removed)> wrote in message
news:74B833DC-1219-4F92-AE0B-(E-Mail Removed)...
> Hi,
> I need to delete subsequent rows, but i have to address the starting and
> the
> end points by referring two cells.
>
> I mean i dont want to use this:
> Rows("2:5").Delete
> But use this(something like this):
> ?? Rows( & Cells(1,2):Cells(1,3) & ).Delete ??
>
> Can you please help? I couldn't find something like that in help pages.
>


 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      22nd Dec 2007
another few to delete rows 2:5 (4 total rows)

Rows(2 & ":" & 5).Delete
or
rows(2).resize(4).delete
or
You can use this kind of syntax when you know the top and bottom rows to delete:
rows(2).resize(5-2+1).delete
like:
Dim TopRow as long
Dim BotRow as long
toprow = 2
botrow = 5
rows(toprow).resize(botrow-toprow+1).delete


nerohnze wrote:
>
> Hi,
> I need to delete subsequent rows, but i have to address the starting and the
> end points by referring two cells.
>
> I mean i dont want to use this:
> Rows("2:5").Delete
> But use this(something like this):
> ?? Rows( & Cells(1,2):Cells(1,3) & ).Delete ??
>
> Can you please help? I couldn't find something like that in help pages.


--

Dave Peterson
 
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
Deleting rows in multiple worksheets Elizabeth Microsoft Excel Programming 5 11th Nov 2008 12:00 AM
Deleting multiple rows with a common field from multiple tables martinmike2 Microsoft Access 8 26th Jul 2008 02:23 PM
Re: deleting multiple rows Pablo Microsoft Excel Misc 0 27th Jan 2005 07:18 PM
deleting multiple rows with multiple criteria Pablo Microsoft Excel Programming 3 27th Jan 2005 02:04 AM
Deleting multiple rows from an SQL Table Robert Brown Microsoft VB .NET 5 3rd Mar 2004 11:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:18 AM.