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: 16
Default Custom defined formula

Hello,
I have the following sub which copies a formula into a cell. When I pass
the address string into the formula I have #value error in the cell
containing the formula. If I eliminate passing in the string argument then
the Calc return value of 2 is displayed. Why is the formula output affected
by the argument input which is not even used.

Thanks
BQ


Sub formulaStuff()

Dim z As Range
Dim r As Integer, c As Integer
Dim str As String

Set z = Range("A1", Range("A1").End(xlDown))
str = z.Address
r = z.Rows.Count
c = z.Columns.Count

Cells(r + 2, 1).Select
ActiveCell.Formula = "=Calc(" & str & ")"


End Sub

Function Calc(strAddress As String) As Long
Calc = 4 / 2
End Function


 
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
Custom Format for User Defined Function [email protected] Excel Discussion (Misc queries) 5 August 7th 06 11:27 PM
User Defined/Custom Input Bonnie. Excel Discussion (Misc queries) 2 October 14th 05 09:04 AM
User-defined (Custom) Charts BHARATH RAJAMANI Charts and Charting in Excel 1 August 23rd 05 08:43 AM
Custom lists - not following defined order Darren Excel Worksheet Functions 1 February 21st 05 02:27 PM
Custom lists - not following defined order [email protected] Excel Worksheet Functions 1 February 21st 05 12:49 PM


All times are GMT +1. The time now is 04:23 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"