Martin,
I'm sorry to bother you but it looks as if you've already got a
solution to something I'm trying to do in MS Excel. I saw the
following message on the microsoft.public.excel.programming list.
Using MS Access, I have some code that runs a query and then outputs
the rows in the result to am MS Excel spreadsheet. I then push a
button in MS Excel to launch a macro in my personal.xls file to
reformat the data. I add filters via the macro to the columns to
enable us to easily look at subsets of the data. I have a little
function that I'd like to add to the newly created spreadsheet so that
I can produce some totals based on visible cells. Here's the
function.
=Sum_Visible_Cells(A1:A5) ' where A1:A5 is the range that you want
to sum and is placed in a cell in the spreadsheet..
Function Sum_Visible_Cells(Cells_To_Sum As Object)
Application.Volatile
For Each cell In Cells_To_Sum
If cell.Rows.Hidden = False Then
If cell.Columns.Hidden = False Then
total = total + cell.Value
End If
End If
Next
Sum_Visible_Cells = total
End Function
Based on your question, it looks as if you have figured out how to
programmatically add code to a spreadsheet. if this is true, would
you object to sharing how you do it?
Thank you.
Best Regards,
Jeff Jones
EDS
5109 Deer Lake Trail
Wake Forest, NC 27587
(e-mail address removed) Tue, 31 Aug 2004 13:56:08 +0100, "Martin