简体   繁体   English

VBA对于Excel,尝试获取范围内每一行的最大值/最小值。

[英]VBA For Excel, Trying to get max / Min value for each row in within range.

I'm trying to work out how to get the maximum and min value for each range within a row within a sheet. 我正在尝试找出如何获取工作表中一行中每个范围的最大值和最小值。

With ThisWorkbook.Sheets("API-VAL")

LastRow = .Range("A1").End(xlDown).row
.Range("BU1:BU1 +(LastRow)").Formula = "=Max(BD1:BS1)" ***- Error in this row.
.Range("BV1:BV1048576").Formula = "=Min(BD1:BS1)"

End With

I'm getting a "Runtime error -'1004'" Application-defined or object-defined error. 我收到“运行时错误-'1004'”应用程序定义或对象定义的错误。 Can anyone point out where I am going wrong? 谁能指出我要去哪里了? Thank you. 谢谢。

.Range(“ BU1:BU”&LastRow).Formula =“ = Max(BD1:BS1)”

.Range("BU1:BU" & CStr(LastRow)).Formula = "=Max(BD1:BS1)" 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM