473,473 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

The following custom formula hangs excel

1 New Member
Expand|Select|Wrap|Line Numbers
  1. Public Function Test(rng As Range) As Double
  2.     Set oRng = Application.ActiveSheet.Range("A1", "A3")
  3.     oRng.Formula = "=C3+C5"
  4.     Test = 0
  5. End Function
I don't know if the problem is that it's not possible to modify the "Formula" property of a cell from a custom formula.
Is there any solution?
Thanks for your help!
Apr 30 '07 #1
1 1047
Killer42
8,435 Recognized Expert Expert
Expand|Select|Wrap|Line Numbers
  1. Public Function Test(rng As Range) As Double
  2.     Set oRng = Application.ActiveSheet.Range("A1", "A3")
  3.     oRng.Formula = "=C3+C5"
  4.     Test = 0
  5. End Function
I don't know if the problem is that it's not possible to modify the "Formula" property of a cell from a custom formula.
Is there any solution?
Thanks for your help!
Not sure exactly what the problem is here, but there are a couple of things which stand out...
  • Where is oRng defined? How does it relate to the parameter rng that was passed to the function?
  • Have you tried commenting out lines of code (starting with all of them commented) to work out exactly where it's hanging?
  • I'm not that familiar with Excel's VBA, so bear with me - is it possible to set .Formula for a range like this, as opposed to an individual cell?
  • Is it possible you have set up some sort of circular reference? For example, is there a formula in cell C3 or C5 which refers to the Test() function? In that case, your function might be causing a calculation which calls your function, which causes a calculation which calls your function, which causes a calculation which calls your function, which causes a calculation which calls your function, ... I think you get the idea - see why that would get hung up?
Apr 30 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Lize | last post by:
Hi, I'm writing an ASP application to open an excel workbook, then run a macro stored in the excel file, which produces outputs that will be displayed back onto my ASP application. Now the...
1
by: Dim | last post by:
Hi, need some help/idea... I have data table in Excel(about 30 columns) and it's getting too big (over 65K) so I need to move it to DB (MS Access is the choice) one of the columns (for example...
0
by: lina | last post by:
Hi, In acc2000, can i export a tbl/qry to xls while having formula written in the table? In my sample table the Excel didn't recognize the data as formula (=C2+D2). But, when in Excel, i enter the...
3
by: prakashsakthivel | last post by:
Hi Members, What I want to know is, I want to detect formula which cells has formula and converted as text. let us example, One excel workbook have 4 sheet. all cells of each sheet contains...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.