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 / March 2006

Tip: Looking for answers? Try searching our database.

Sum Cells or Range and Insert Value into Cell

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bill Ray - 21 Mar 2006 05:09 GMT
I am attempting to sum a range (Range_i) and then insert the values
into a cell. I am receiving the Type Mismatch error. Any help would be
appreciated.

Bill

==============================

Sub Macro1()

   ActiveSheet.Cells(66, 15) = SumArray(Range_i)
   'Cells above is Cells(Row number, Column number)
   
End Sub

Function SumArray(List)
   SumArray = 0
   For Each Item In List
       If Application.IsNumber(Item) Then _
           SumArray = SumArray + Item
   Next Item
End Function
Tom Ogilvy - 21 Mar 2006 06:43 GMT
have you dimensioned Range_i as Range and assigned it to a value

try

Sub Macro1()
 if typename(Range_i)  = "Range" then
   if not Range_i is nothing then
    MsgBox Range_i.Address
   else
    msgBox "Range_i has not been set"
   end if
 else
   msgbox "Range_i is not a range reference"
 end if
    ActiveSheet.Cells(66, 15) = SumArray(Range_i)
    'Cells above is Cells(Row number, Column number)

End Sub

Signature

Regards,
Tom Ogilvy

> I am attempting to sum a range (Range_i) and then insert the values
> into a cell. I am receiving the Type Mismatch error. Any help would be
[quoted text clipped - 18 lines]
>     Next Item
> End Function
 
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.