PC Review


Reply
Thread Tools Rate Thread

Deleting Rows At Bottom

 
 
=?Utf-8?B?d2lsbGlhbXI=?=
Guest
Posts: n/a
 
      19th Mar 2007
I'm trying to delete the last 4 rows in some worksheets where the last row
with data changes but it's always the last 4 rows that need to be deleted.
Currently I'm doing this manually. Can someone help me with some VBA code?

Thanks
Wm.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?VmVyZ2VsIEFkcmlhbm8=?=
Guest
Posts: n/a
 
      19th Mar 2007
Maybe something like this:

Sub DeleteLast4Rows()
Dim lRow As Long

lRow = ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row
If lRow < 4 Then Exit Sub
ActiveSheet.Range(lRow - 3 & ":" & lRow).Delete

End Sub



--

Hope that helps.

Vergel Adriano


"williamr" wrote:

> I'm trying to delete the last 4 rows in some worksheets where the last row
> with data changes but it's always the last 4 rows that need to be deleted.
> Currently I'm doing this manually. Can someone help me with some VBA code?
>
> Thanks
> Wm.

 
Reply With Quote
 
RB Smissaert
Guest
Posts: n/a
 
      19th Mar 2007
Range(Cells(Rows.Count - 3, 1), Cells(Rows.Count, Columns.Count)).Delete

RBS

"williamr" <(E-Mail Removed)> wrote in message
news:C21E29F6-890F-47E0-96DA-(E-Mail Removed)...
> I'm trying to delete the last 4 rows in some worksheets where the last row
> with data changes but it's always the last 4 rows that need to be deleted.
> Currently I'm doing this manually. Can someone help me with some VBA
> code?
>
> Thanks
> Wm.


 
Reply With Quote
 
=?Utf-8?B?d2lsbGlhbXI=?=
Guest
Posts: n/a
 
      19th Mar 2007
Thank you both!! it works well
Wm.

"RB Smissaert" wrote:

> Range(Cells(Rows.Count - 3, 1), Cells(Rows.Count, Columns.Count)).Delete
>
> RBS
>
> "williamr" <(E-Mail Removed)> wrote in message
> news:C21E29F6-890F-47E0-96DA-(E-Mail Removed)...
> > I'm trying to delete the last 4 rows in some worksheets where the last row
> > with data changes but it's always the last 4 rows that need to be deleted.
> > Currently I'm doing this manually. Can someone help me with some VBA
> > code?
> >
> > Thanks
> > Wm.

>
>

 
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
locked rows on top and bottom TPearls Microsoft Excel Misc 6 22nd Mar 2009 06:34 PM
Excel thinks I have another 200+ rows at the bottom of my rows. H. =?Utf-8?B?Q3JhaWc=?= Microsoft Access 7 15th Feb 2006 11:55 PM
Excel 2000 VBA Deleting Rows when certain text in rows exists scain2004 Microsoft Excel New Users 1 15th Mar 2004 02:11 AM
Rows to repeat at bottom: ? notty28 Microsoft Excel Misc 2 14th Mar 2004 12:01 PM
Deleting rows at bottom of sheet =?Utf-8?B?QmV0aGFueQ==?= Microsoft Excel Misc 3 21st Jan 2004 05:28 AM


Features
 

Advertising
 

Newsgroups
 


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