Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 397
Default Find last row and delete from +1 to end


Hi all,

Im sure ive done this before, but cant get it to work now!

I want to using column A as the data source find the last piece of data,
and then delete from the next row (Ie keeping the last piece of data) to
the last row(65536)

eg if last piece of data is in A156, Macro needs to delete from
157:65536


Thanks

D

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Find last row and delete from +1 to end

Dim NextRow as long
with activesheet
Nextrow = .cells(.rows.count,"A").end(xlup).row + 1
.rows(nextrow & ":" & .rows.count).delete
end with

Darin Kramer wrote:

Hi all,

Im sure ive done this before, but cant get it to work now!

I want to using column A as the data source find the last piece of data,
and then delete from the next row (Ie keeping the last piece of data) to
the last row(65536)

eg if last piece of data is in A156, Macro needs to delete from
157:65536

Thanks

D

*** Sent via Developersdex http://www.developersdex.com ***


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 397
Default Find last row and delete from +1 to end



Dave, I must be doing something wrong?? , it doesnt seem to delete the
rows? (I can tell cause they got cell borders all the way around them!)

*** Sent via Developersdex http://www.developersdex.com ***
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Find last row and delete from +1 to end

If you formatted the entire column with the borders, then excel knows to keep
that formatting.

If you select the last cell in column A and hit End followed by up arrow, do you
go to the last cell used in column A?

If you want to clear formats, you could use:

Dim NextRow As Long
With ActiveSheet
NextRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
With .Rows(NextRow & ":" & .Rows.Count)
.Clear
.Delete
End With
End With



Darin Kramer wrote:

Dave, I must be doing something wrong?? , it doesnt seem to delete the
rows? (I can tell cause they got cell borders all the way around them!)

*** Sent via Developersdex http://www.developersdex.com ***


--

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
Find and Replace - delete the remainder of the text in the cell after my Find [email protected] Excel Programming 4 August 4th 07 03:39 AM
find and delete enyaw Excel Programming 2 June 12th 06 09:31 AM
find row and delete Native Excel Discussion (Misc queries) 2 February 2nd 05 09:46 PM
find and delete duplicate entries in two columns or find and prin. campare 2 columns of numbers-find unique Excel Programming 1 November 24th 04 04:09 PM
find and delete text, find a 10-digit number and put it in a textbox Paul Excel Programming 3 November 16th 04 04:21 PM


All times are GMT +1. The time now is 02:57 PM.

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

About Us

"It's about Microsoft Excel"