Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.scripting.vbscript,microsoft.public.excel.misc,microsoft.public.excel.programming
|
|||
|
|||
![]()
Assume I want to get the sum of values of all cells from the range "H6:H18" from an Excel Worksheet.
How can I do this within vbs script? Claudia |
#2
![]()
Posted to microsoft.public.scripting.vbscript,microsoft.public.excel.misc,microsoft.public.excel.programming
|
|||
|
|||
![]()
This will definitely work for you.
Sub SumRange() Dim myRange As Range Dim cell As Range Dim rngtotal As Double Set myRange = Sheets("Sheet1").Range("H6:H18") For Each cell In myRange rngtotal = rngtotal + cell Next cell MsgBox "The Sum of Range(''H6:H18'') = " & rngtotal End Sub Hope it helps! -- Cheers, Ryan "Claudia d'Amato" wrote: Assume I want to get the sum of values of all cells from the range "H6:H18" from an Excel Worksheet. How can I do this within vbs script? Claudia |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
This looks like VBA.
Doesn't OP want vbscript? Gord Dibben MS Excel MVP On Thu, 26 Jun 2008 10:58:00 -0700, RyanH wrote: This will definitely work for you. Sub SumRange() Dim myRange As Range Dim cell As Range Dim rngtotal As Double Set myRange = Sheets("Sheet1").Range("H6:H18") For Each cell In myRange rngtotal = rngtotal + cell Next cell MsgBox "The Sum of Range(''H6:H18'') = " & rngtotal End Sub Hope it helps! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to delete the content of Excel cells from VBS script? | Excel Discussion (Misc queries) | |||
If certain cells not blank, and cells in range are, set values to | Excel Discussion (Misc queries) | |||
Count values in a range of cells | Excel Worksheet Functions | |||
Find a range of values in a range of cells | Excel Worksheet Functions | |||
How do I sum the absolute values of a range of cells? | Excel Discussion (Misc queries) |