Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Insert a column within a range of cells | Excel Worksheet Functions | |||
Insert range of cells with a function | Excel Worksheet Functions | |||
insert picture to a specfic range of cells | Excel Discussion (Misc queries) | |||
How to insert formula to a range of cells from VBA? | Excel Programming | |||
How can I insert a space before the last character in a range of cells | Excel Programming |