ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   minimum value (https://www.excelbanter.com/excel-programming/373675-minimum-value.html)

kirke

minimum value
 
I want to save the minimum value of column B at "d"
So i define.
==============

Dim d As Long

d="=MIN($B:$B)"
================


However, it doesn't work. How can I save the number?
I can print it on a cell (for example, Cells(1,1)="=MIN($B:$B)" )

Thx'''


Ken Hudson

minimum value
 
Hi,

Are you wanting to assign the minimum value to the variable "d?"

d = WorksheetFunction.Min(Columns("B"))

HTH
--
Ken Hudson


"kirke" wrote:

I want to save the minimum value of column B at "d"
So i define.
==============

Dim d As Long

d="=MIN($B:$B)"
================


However, it doesn't work. How can I save the number?
I can print it on a cell (for example, Cells(1,1)="=MIN($B:$B)" )

Thx'''



Bob Phillips

minimum value
 
You cannot use a worksheet function directly in VBA, but you can call it as
part of the application object

d = Application.MIN(Range("B:B"))

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"kirke" wrote in message
oups.com...
I want to save the minimum value of column B at "d"
So i define.
==============

Dim d As Long

d="=MIN($B:$B)"
================


However, it doesn't work. How can I save the number?
I can print it on a cell (for example, Cells(1,1)="=MIN($B:$B)" )

Thx'''





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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com