LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Sum cells, excluding hidden columns

Hi all :)

I have a nice little spreadsheet (well not so little) and a requirement in a
column to sum preceeding columns of data. However I don't want to include
hidden columns.

I found this nice little vba programming on a site somewhere (have to love
google). And it works perfectly if summing cells that are in a range i.e.
A1:A10.

Function VisTotal(Rg As Range)
Dim x, tot
Application.Volatile
tot = 0
For Each x In Rg
If x.ColumnWidth = 0 Or x.RowHeight = 0 Then Else tot = tot + x
Next
VisTotal = tot
End Function

However it does not work if the range is not consistent i.e. A1,A4,A10. It
will work if I refer to named ranges, however I would need to create over 200
named ranges for this (bit of a job).

Any ideas on how this VBA could be modified so it will deal with a non
consistent range like A1,A4,A10??

Regards

James
 
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
Subtoal excluding hidden columns Trevor Excel Worksheet Functions 7 November 25th 08 05:56 PM
Excluding formulas in hidden cells? Adam L. Kehl Excel Worksheet Functions 3 April 10th 08 03:35 PM
Counting non-blank cells in a column, excluding hidden rows SisterDell Excel Worksheet Functions 3 June 1st 07 03:31 PM
Need to sum columns, excluding hidden columns. psill Excel Discussion (Misc queries) 7 October 13th 06 07:49 PM
Need to sum columns, excluding hidden ones - like 'subtotal' for r psill Excel Discussion (Misc queries) 0 October 12th 06 08:14 PM


All times are GMT +1. The time now is 01:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"