#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Formulas

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,393
Default Formulas

Not sure what you really need but have you tried =MAX(A:A) ?
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Sincere" wrote in message
...
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




  #3   Report Post  
Posted to microsoft.public.excel.programming
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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,393
Default Formulas

Michael, the Yes button is not visible when you read groups with Outlook
Express (and many other newsgroup readers)
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Michael" wrote in message
...
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




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Formulas

Hello,

I did tried something which helped me get my work done; below is the code
for reveiw.

Sub Iterate()


Dim r As Integer

r = 1



Me.Range("C6").Activate



Do While 1 = 1

If Me.Range("C6").Cells(r, 1).Value < 0 Then

Debug.Print Me.Range("c6").Cells(r, 1).Value

Else

Debug.Print "Null"

End If

If Me.Range("C6").Cells(r, 1).Value = 0 Then

Me.Range("E4").Value = Me.Range("C6").Cells(r - 1, 1).Value + 1

Debug.Print Range("E4").Value

MsgBox "No more numbers"

r = 0

Exit Sub

End If

r = r + 1

Loop

***** Rem Me.Range("E4").Value = Me.Range("C6").Cells(r - 1, 1).Value +
1
Example
-----------
1
2
3
* when the loop comes here; it found no value, therefore i used the r-1 to
get the last max. value

End Sub


Thanks Indeed, I would appreciate if I can be with more advises or more
resources.

"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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
E2007 formulas display as formulas, not results Pierre Excel Worksheet Functions 3 January 14th 10 04:59 PM
Counting # of Formulas in a column with formulas and entered data Brand Excel Worksheet Functions 1 October 10th 09 01:01 PM
CELLS NOT CALC FORMULAS - VALUES STAY SME FORMULAS CORRECT?? HELP Sherberg Excel Worksheet Functions 4 September 11th 07 01:34 AM
Formulas not evaluated, Formulas treated as strings Bob Sullentrup Excel Discussion (Misc queries) 0 November 27th 06 08:01 PM
AdvancedFilter on cells with formulas, returning values and not formulas Claus[_3_] Excel Programming 2 September 7th 05 02:40 PM


All times are GMT +1. The time now is 07:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"