[英]Select a column from maximum cell to first cell
I am new to Excel VBA. 我是Excel VBA的新手。 I got some data of 742 rows from this data I want to select from MAX value to first row.
我要从MAX值选择第一行的数据中获得742行的一些数据。 Eg Suppose my maximum value is "240" in cell "A480", so I want to select a column from cell "A480" to cell "A1".
例如,假设我的最大值是单元格“ A480”中的“ 240”,那么我想从单元格“ A480”到单元格“ A1”中选择一列。
Any one know how to do this. 有人知道怎么做吗。
Try this: 尝试这个:
Sub MaxNumberRow()
Dim max As Double
Dim rowNum As Long
With Sheet1
max = WorksheetFunction.max(.Columns(1))
If max > 0 Then
rowNum = .Columns(1).Find(What:=max, After:=.Cells(1, 1), LookIn:=xlValues, LookAt:= xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False).Row
Range(Cells(1, 1), Cells(rowNum, 1)).Select
End If
End With
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.