ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sum Visible (https://www.excelbanter.com/excel-programming/317782-sum-visible.html)

MattShoreson[_14_]

Sum Visible
 

I have an addin which has a menu item calling a procedure summing al
visible cells in a selection.

I am having problems setting the range/selection to be active withi
the proc.

Dim sum_range As Object
Set sum_range = Selection
MsgBox sum_range.Column.Count

Does anyone have any ideas

--
MattShoreso
-----------------------------------------------------------------------
MattShoreson's Profile: http://www.excelforum.com/member.php...nfo&userid=347
View this thread: http://www.excelforum.com/showthread.php?threadid=32035


MattShoreson[_15_]

Sum Visible
 

It's ok.

Was using column instead of columnS!!!!

--
MattShoreso
-----------------------------------------------------------------------
MattShoreson's Profile: http://www.excelforum.com/member.php...nfo&userid=347
View this thread: http://www.excelforum.com/showthread.php?threadid=32035


Harald Staff

Sum Visible
 
Hi Matt

Sub test()
Dim sum_range As Range
Set sum_range = Selection.SpecialCells(xlCellTypeVisible)
MsgBox Application.Sum(sum_range)
End Sub

HTH. Best wishes Harald

"MattShoreson" skrev i melding
...

I have an addin which has a menu item calling a procedure summing all
visible cells in a selection.

I am having problems setting the range/selection to be active within
the proc.

Dim sum_range As Object
Set sum_range = Selection
MsgBox sum_range.Column.Count

Does anyone have any ideas?


--
MattShoreson
------------------------------------------------------------------------
MattShoreson's Profile:

http://www.excelforum.com/member.php...fo&userid=3472
View this thread: http://www.excelforum.com/showthread...hreadid=320353





All times are GMT +1. The time now is 11:21 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com