LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 115
Default Macro to select a row that has max value and paste it in an empty row

I have the following code to find the max value in range E of a
worksheet.

Option Explicit
Sub findmax()

Dim c As Range
Dim x As Double

x = Application.WorksheetFunction.Max(Range("E:E"))
Set c = Range("E:E").Find(x, LookIn:=xlValues)
If Not c Is Nothing Then
c.Offset(0, 0).Select
End If
End Sub

For example, if range E has values in first 50 cells and if cell E35
has the max value, present code selects cell E35. Instead of just
having E35 selection, I would to have the full row 35 to be selected.
Please let me know the code for this. This is the primary thing I am
looking for.

Secondly, the selected row (row 35 in this example) must be pasted in
a row that does not have any values. In other words, if there is data
in a row, then that row(s) must be skipped and the row35 must be
pasted in a row that does not contain any data/values.

Please let me know how to accomplish this. I would really appreciate
any help. This problem has already consumed my 4 hours this morning..
Thanks
 
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
Select next empty row from macro rick_mc Excel Programming 2 March 28th 07 06:49 PM
Select next empty row from macro rick_mc Excel Programming 0 March 28th 07 01:10 AM
how do i make a macro that will select all those cells that are empty VB Script for Excel Excel Programming 2 April 27th 06 09:06 AM
Select empty column & paste - Help please saziz[_50_] Excel Programming 6 December 20th 05 06:48 PM
Macro to select non empty rows in a given range Mario Excel Programming 1 January 23rd 04 07:54 PM


All times are GMT +1. The time now is 07:21 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"