Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Deleting rows following the max point

Hi all,
I have set of data that increase to reach a maximum and decrease after that.
I need to find the maximum and delete all the data after this maximum.
I can not find how to delete the entire row after my max point....

The begining of my code:

Sub remove_decrease()
'Remove decrease portion portion
Dim top
top = Application.Match(Application.max(Columns(1)), Columns(1), 0)
'Give the position of the maximum force = top
top = top + 1
'.... need to remove all the next rows...
End Sub


Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Deleting rows following the max point

Hi,

Try this

Sub remove_decrease()
Dim RowNo As Long, lastrow As Long
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
TheMax = WorksheetFunction.Max(Columns(1))
TheRow = Columns(1).Find(What:=TheMax, After:=Cells(1, 1)).Row
Range("A" & TheRow + 1 & ":A" & lastrow).ClearContents
End Sub

Mike

"Lucile" wrote:

Hi all,
I have set of data that increase to reach a maximum and decrease after that.
I need to find the maximum and delete all the data after this maximum.
I can not find how to delete the entire row after my max point....

The begining of my code:

Sub remove_decrease()
'Remove decrease portion portion
Dim top
top = Application.Match(Application.max(Columns(1)), Columns(1), 0)
'Give the position of the maximum force = top
top = top + 1
'.... need to remove all the next rows...
End Sub


Thanks!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Deleting rows following the max point

Exellent!! Thank you very much!

"Mike H" wrote:

Hi,

Try this

Sub remove_decrease()
Dim RowNo As Long, lastrow As Long
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
TheMax = WorksheetFunction.Max(Columns(1))
TheRow = Columns(1).Find(What:=TheMax, After:=Cells(1, 1)).Row
Range("A" & TheRow + 1 & ":A" & lastrow).ClearContents
End Sub

Mike

"Lucile" wrote:

Hi all,
I have set of data that increase to reach a maximum and decrease after that.
I need to find the maximum and delete all the data after this maximum.
I can not find how to delete the entire row after my max point....

The begining of my code:

Sub remove_decrease()
'Remove decrease portion portion
Dim top
top = Application.Match(Application.max(Columns(1)), Columns(1), 0)
'Give the position of the maximum force = top
top = top + 1
'.... need to remove all the next rows...
End Sub


Thanks!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Deleting rows following the max point

Glad I could help

"Lucile" wrote:

Exellent!! Thank you very much!

"Mike H" wrote:

Hi,

Try this

Sub remove_decrease()
Dim RowNo As Long, lastrow As Long
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
TheMax = WorksheetFunction.Max(Columns(1))
TheRow = Columns(1).Find(What:=TheMax, After:=Cells(1, 1)).Row
Range("A" & TheRow + 1 & ":A" & lastrow).ClearContents
End Sub

Mike

"Lucile" wrote:

Hi all,
I have set of data that increase to reach a maximum and decrease after that.
I need to find the maximum and delete all the data after this maximum.
I can not find how to delete the entire row after my max point....

The begining of my code:

Sub remove_decrease()
'Remove decrease portion portion
Dim top
top = Application.Match(Application.max(Columns(1)), Columns(1), 0)
'Give the position of the maximum force = top
top = top + 1
'.... need to remove all the next rows...
End Sub


Thanks!

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Deleting rows following the max point

Ah,

You wanted to delete the entire row not just clear then contents. Try this
instead

Sub remove_decrease()
Dim RowNo As Long, lastrow As Long
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
TheMax = WorksheetFunction.Max(Columns(1))
TheRow = Columns(1).Find(What:=TheMax, After:=Cells(1, 1)).Row
Range("A" & TheRow + 1 & ":A" & lastrow).EntireRow.Delete
End Sub

Mike

"Mike H" wrote:

Hi,

Try this

Sub remove_decrease()
Dim RowNo As Long, lastrow As Long
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
TheMax = WorksheetFunction.Max(Columns(1))
TheRow = Columns(1).Find(What:=TheMax, After:=Cells(1, 1)).Row
Range("A" & TheRow + 1 & ":A" & lastrow).ClearContents
End Sub

Mike

"Lucile" wrote:

Hi all,
I have set of data that increase to reach a maximum and decrease after that.
I need to find the maximum and delete all the data after this maximum.
I can not find how to delete the entire row after my max point....

The begining of my code:

Sub remove_decrease()
'Remove decrease portion portion
Dim top
top = Application.Match(Application.max(Columns(1)), Columns(1), 0)
'Give the position of the maximum force = top
top = top + 1
'.... need to remove all the next rows...
End Sub


Thanks!



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
Macro for deleting rows and serialising the remaing rows Srinivasulu Bhattaram Links and Linking in Excel 1 November 13th 08 08:44 AM
How to add rows, to point to new row nastech Excel Discussion (Misc queries) 5 June 13th 06 09:18 AM
Deleting rows to a defined point Tim Green Excel Programming 2 March 21st 06 03:55 PM
deleting hidden rows so i can print only the rows showing?????? jenn Excel Worksheet Functions 0 October 6th 05 04:05 PM
Delete Rows above a certain point steve Excel Programming 0 October 28th 03 06:42 PM


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

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"