[AccessD] OT - Specifying Excel Ranges

Hale, Jim Jim.Hale at FleetPride.com
Thu Dec 14 11:58:53 CST 2006


Play with this, it may give you some ideas. It puts a sum formula at the
bottom of a variable column of numbers starting at e5.
Jim Hale

Function test()
Dim rng As Range, i As Integer, strAddressBottom As String, strAddressTop As
String
Set rng = Range("e5")
strAddressTop = rng.Address
For i = 1 To 25
    If rng.Offset(i, 0).Value = "" Then
        strAddressBottom = rng.Offset(i - 1, 0).Cells.Address
        rng.Offset(i, 0).Formula = "=sum(" & strAddressTop & ":" &
strAddressBottom & ")"
        GoTo The_End
    End If
Next
The_End:
Set rng = Nothing
End Function

-----Original Message-----
From: Reuben Cummings [mailto:reuben at gfconsultants.com]
Sent: Thursday, December 14, 2006 11:11 AM
To: AccessD
Subject: [AccessD] OT - Specifying Excel Ranges


I have a case where I need to change the number of rows in Excel formulas
quickly.  The problem there are about 8 formulas per 'group' of numbers that
I will have to change everytime I need to change the number of rows.  Going
into and changing 8 formulas is a pain.

What I would like to is create the formula in one cell and in two other
cells specify the upper row limit and lower row limit.

For example, I want Average(C2:C10).  However, rather than specifying C2 or
C10 I want to put 2 and 10 in two other cells and let the formula reference
those cells in order to get that range.  If I change it to 4 and 7 my new
formula would now be average(C4:C7) (at least that's how it would
calculate).  Then another formula would automatically change from
median(D2:D10) to median(D4:D7)

This would allow me change the 2 or 10 only one time, but it would change
all 8 formulas in the group.

Any ideas?

Thanks.

Reuben Cummings
GFC, LLC
812.523.1017




-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

***********************************************************************
The information transmitted is intended solely for the individual or
entity to which it is addressed and may contain confidential and/or
privileged material. Any review, retransmission, dissemination or
other use of or taking action in reliance upon this information by
persons or entities other than the intended recipient is prohibited.
If you have received this email in error please contact the sender and
delete the material from any computer. As a recipient of this email,
you are responsible for screening its contents and the contents of any
attachments for the presence of viruses. No liability is accepted for
any damages caused by any virus transmitted by this email.


More information about the AccessD mailing list