Hale, Jim
Jim.Hale at FleetPride.com
Fri Mar 17 15:27:21 CST 2006
Maybe this will give you some ideas. Starting at the top of the range e5 it finds the last number in the column and places a sum formula underneath. 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: Lawrence Mrazek [mailto:lmrazek at lcm-res.com] Sent: Friday, March 17, 2006 2:51 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Export to Excel via VBA, Naming Cells Solved my syntax issue: The following worked to assign a name to single cell RangeName = rsSales.Fields("SalesRep") & rsSales.Fields("itemtype") & rsSales.Fields("month") CellLocation = "=" & WrkSheetName & "!$" & "f" & "$" & rownum xlWb.Names.Add Name:=RangeName, RefersTo:=CellLocation, Visible:=True Now comes the fun part ... Adding calculations to the mix. Larry Mrazek LCM Research, Inc. www.lcm-res.com lmrazek at lcm-res.com ph. 314-432-5886 fx. 314-432-3304 *********************************************************************** 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.