Thread: Formulas
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Michael Michael is offline
external usenet poster
 
Posts: 791
Default Formulas

I think you need to define your range dynamically something like this:
Dim iLastRow As Integer

iLastRow = Range("B65536").End(xlUp).Row

Myrange = Range("B1:B" & iLastRow).Address

Worksheets("Sheet1").Range("C1").Value = "=Max(" & Myrange & ")"

End Sub
--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"Sincere" wrote:

Hello,

I have a monitoring sheet which consists of a sequence of numbers, at the
moment I have used a =MAX() formula to display the maximum # on the status
bar, this works simple as I have defined the range. Now I want it to be more
dynamic; where I shouldn't be giving the range in fact there should be
iteration on the particular cell and there it should determine the maximum #
and add 1 to it.

Can anyone tell me how to use it and how to use such formulas in VBA

E.g.

Total Tasks = 4 (assuming this is the highest # so far)

A
--------------
1
2
3
4


I should rather iterate instead of using a defined range.


TIA

Regards

Mumshad