Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / September 2007

Tip: Looking for answers? Try searching our database.

Formulas

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sincere - 12 Sep 2007 19:28 GMT
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
Bernard Liengme - 12 Sep 2007 19:31 GMT
Not sure what you really need but have you tried =MAX(A:A) ?
best wishes
Signature

Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

> Hello,
>
[quoted text clipped - 27 lines]
>
> Mumshad
Michael - 12 Sep 2007 20:16 GMT
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
Signature

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

Michael Arch.

> Hello,
>
[quoted text clipped - 25 lines]
>
> Mumshad
Bernard Liengme - 12 Sep 2007 20:22 GMT
Michael, the Yes button is not visible when you read groups with Outlook
Express (and many other newsgroup readers)
best wishes
Signature

Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

>I think you need to define your range dynamically something like this:
> Dim iLastRow As Integer
[quoted text clipped - 39 lines]
>>
>> Mumshad
Sincere - 13 Sep 2007 08:12 GMT
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.

> Hello,
>
[quoted text clipped - 25 lines]
>
> Mumshad
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.