ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Set a constant from a formula in VBA (https://www.excelbanter.com/excel-discussion-misc-queries/120590-set-constant-formula-vba.html)

Ed

Set a constant from a formula in VBA
 
I have now this:

Dim K As Long
With Sheets("A")
K = ( * here I want to have as k the result of the fomula =MAX(A:A).)

How do I manage to take values from formulas rather than a specific cell?

,thanks

Dave Peterson

Set a constant from a formula in VBA
 
Dim K as double ' you sure you want Long???

with sheets("a")
k = application.max(.range("a:a"))
end with



Ed wrote:

I have now this:

Dim K As Long
With Sheets("A")
K = ( * here I want to have as k the result of the fomula =MAX(A:A).)

How do I manage to take values from formulas rather than a specific cell?

,thanks


--

Dave Peterson


All times are GMT +1. The time now is 10:18 AM.

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