LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Recalculation of User Function when Hiding arguments

Tom Ogilvy wrote:
I couldn't reproduce any behavior like that in Excel 2003.


OK,

I have some code below to reproduce the problem under Excel 2003.

Copy in this code and run BuildWorkbook to insert some functions. It
will give error message in cells A7 down (never knew it would produce
error on building!). Recalculate function A7 down by pressing F2 and
Ctrl+Shift+Enter. Now double-click in Cell A1.

The reason for using Text property is because the parameters for the
function are all over the workbook and I have linked some cells so that
they can be read in as one range. Unfortunatly when you have a link to
a blank cell Excel gives a 0 as the formula result, which is sometimes a
valid parameter. I have used conditional formatting to blank out this
value as neccessary, and then the text property to access the values.

This is probably not a good solution, so if anyone has a better (or even
different:-)) idea please post.

Thanks

Code in Module 1 is :

Public Function RangeText(R As Range) As String
On Error GoTo Failed
RangeText = R.Text
Exit Function
Failed:
RangeText = Err.Description
End Function

Public Sub BuildWorkbook()
'build worksheet
ActiveSheet.Cells(1, 1).Value = "Double-click this cell to hide"
ActiveSheet.Cells(5, 1).Value = "5"
ActiveSheet.Cells(7, 1).Resize(5, 1).FormulaArray = "=RangeText(A5)"
End Sub


Code in Sheet1 is :

Private unhide_ As Boolean

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Target.Address = ActiveSheet.Cells(1, 1).Address Then

If unhide_ Then
Target.Value = "Double-click this cell to hide"
Else
ActiveSheet.Cells(5, 1).EntireRow.Hidden = True
Target.Value = "Double-click this cell to unhide"
End If

unhide_ = Not unhide_
ActiveSheet.Cells(5, 1).EntireRow.Hidden = unhide_

Cancel = True
End If
End Sub

---
David (posting from a different address)


 
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
recalculation not recalculating some cells containing user functio velvetlady Excel Discussion (Misc queries) 2 January 14th 10 07:31 PM
empty arguments recalculation Jorge Suzan Excel Worksheet Functions 1 November 30th 09 06:01 PM
Recalculation on hiding rows in Excel 2003 Cantoris Excel Discussion (Misc queries) 1 December 4th 06 02:12 AM
weird recalculation of user defined function timspier Excel Worksheet Functions 3 May 14th 06 05:39 AM
Excel user-defined Function: definition/help of arguments fmoi1 Excel Programming 1 July 16th 04 03:23 PM


All times are GMT +1. The time now is 08:22 PM.

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"