Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 126
Default How to del last two rows

Hi Guys.
It dosn't matter how many row in the worksheet.
how to create a formula or macro to del only the last two rows.


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 126
Default How to del last two rows

the last 2 rows that I want to del is not the last two rows of the worksheet.
the last 2 rows I want to del is in my report, sometime the last two rows at
row 258 and 259. or 158,159, or 236,237.

"jlclyde" wrote:

On Nov 20, 12:39 pm, Johnny wrote:
Hi Guys.
It dosn't matter how many row in the worksheet.
how to create a formula or macro to del only the last two rows.


All worksheets have the same number of rows. If you want to delete
rows 65536 and 65535 that is a simple macro.
Sub Deletelast2rows()

Range("A65535", "IV65536").Delete

End Sub
If you want the last two rows that have something in them then that is
a little trickier.

You will use End(xl(up)
Jay

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default How to del last two rows

Can you pick out a column that would be used to determine that last used row?

Dim LastRow as long
with worksheets("sheet9999")
lastrow = .cells(.rows.count,"A").end(xlup).row
if lastrow 1 then
.rows(lastrow-1).resize(2).delete
end if
end with

I used column A to determine that last used row.

Johnny wrote:

the last 2 rows that I want to del is not the last two rows of the worksheet.
the last 2 rows I want to del is in my report, sometime the last two rows at
row 258 and 259. or 158,159, or 236,237.

"jlclyde" wrote:

On Nov 20, 12:39 pm, Johnny wrote:
Hi Guys.
It dosn't matter how many row in the worksheet.
how to create a formula or macro to del only the last two rows.


All worksheets have the same number of rows. If you want to delete
rows 65536 and 65535 that is a simple macro.
Sub Deletelast2rows()

Range("A65535", "IV65536").Delete

End Sub
If you want the last two rows that have something in them then that is
a little trickier.

You will use End(xl(up)
Jay


--

Dave Peterson
Reply
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
Copy rows of data (eliminating blank rows) from fixed layout Sweepea Excel Discussion (Misc queries) 1 March 13th 07 11:05 PM
Excel 2003 -Rows hidden. Scrolling unhides rows ! How do I stop th Excellent1975 Excel Discussion (Misc queries) 0 June 21st 06 08:01 PM
Copying multiple rows to other worksheets (but amount of rows varies) - How? David Smithz Excel Discussion (Misc queries) 1 June 18th 06 04:31 PM
Pivot Tables: How do I show ALL field rows, including empty rows?? [email protected] Excel Worksheet Functions 2 April 8th 05 06:21 PM
flexible paste rows function that inserts the right number of rows marika1981 Excel Discussion (Misc queries) 1 February 18th 05 02:40 AM


All times are GMT +1. The time now is 09:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"