Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sum Cells or Range and Insert Value into Cell

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Sum Cells or Range and Insert Value into Cell

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

--
Regards,
Tom Ogilvy


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




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
Insert a column within a range of cells Retirement Guy Excel Worksheet Functions 4 June 23rd 07 12:04 AM
Insert range of cells with a function firsttimer Excel Worksheet Functions 2 May 29th 07 09:43 AM
insert picture to a specfic range of cells CORY Excel Discussion (Misc queries) 8 February 3rd 06 05:50 PM
How to insert formula to a range of cells from VBA? crapit Excel Programming 10 March 18th 05 01:38 PM
How can I insert a space before the last character in a range of cells Jeff[_25_] Excel Programming 8 November 13th 03 07:45 PM


All times are GMT +1. The time now is 01:12 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"