Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I want to paste a formula which has a defined name and does not exist in any cell on any worksheet before I paste it. I know that
defined name formulas can be referred to by other formulas on a worksheet, but I want to paste the defined name formulas programmatically. I know that there are other ways to accomplish what I'm doing in my project without using the named formulas, but using them would be a lot cleaner for me and I want to take advantage of that feature if possible. Any ideas? -- RMC,CPA |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
is this what you're after Sub pasteformula() Range("D1").Formula = "=SUM(myname)" End Sub Cheers JulieD "R. Choate" wrote in message ... I want to paste a formula which has a defined name and does not exist in any cell on any worksheet before I paste it. I know that defined name formulas can be referred to by other formulas on a worksheet, but I want to paste the defined name formulas programmatically. I know that there are other ways to accomplish what I'm doing in my project without using the named formulas, but using them would be a lot cleaner for me and I want to take advantage of that feature if possible. Any ideas? -- RMC,CPA |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
No, what I'm referring to is where the formula itself has a "range name" instead of the normal case where a range name refers to
cells on a worksheet. Lets say the formula is "=B1-B2" and the formula's name is "NetPounds". I want to paste my formula in various places and refer to it by its name, "NetPounds". To use your example, my code would look more like: Sub pasteformula() Range("D1").Formula = "NetPounds" End Sub Any ideas? Thanks! -- RMC,CPA "JulieD" wrote in message ... Hi is this what you're after Sub pasteformula() Range("D1").Formula = "=SUM(myname)" End Sub Cheers JulieD "R. Choate" wrote in message ... I want to paste a formula which has a defined name and does not exist in any cell on any worksheet before I paste it. I know that defined name formulas can be referred to by other formulas on a worksheet, but I want to paste the defined name formulas programmatically. I know that there are other ways to accomplish what I'm doing in my project without using the named formulas, but using them would be a lot cleaner for me and I want to take advantage of that feature if possible. Any ideas? -- RMC,CPA |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try:
Sub pasteformula() Range("D1").Formula = "=NetPounds" End Sub Be careful though because the range formula will be relative to the cell you were in when you created the Named Range Formula. For example, I tested your example in cell A1 with the formula =B1-B2. When I copied the formula to cell A6 it refers to =B6-B7. Regards Trevor "R. Choate" wrote in message ... No, what I'm referring to is where the formula itself has a "range name" instead of the normal case where a range name refers to cells on a worksheet. Lets say the formula is "=B1-B2" and the formula's name is "NetPounds". I want to paste my formula in various places and refer to it by its name, "NetPounds". To use your example, my code would look more like: Sub pasteformula() Range("D1").Formula = "NetPounds" End Sub Any ideas? Thanks! -- RMC,CPA "JulieD" wrote in message ... Hi is this what you're after Sub pasteformula() Range("D1").Formula = "=SUM(myname)" End Sub Cheers JulieD "R. Choate" wrote in message ... I want to paste a formula which has a defined name and does not exist in any cell on any worksheet before I paste it. I know that defined name formulas can be referred to by other formulas on a worksheet, but I want to paste the defined name formulas programmatically. I know that there are other ways to accomplish what I'm doing in my project without using the named formulas, but using them would be a lot cleaner for me and I want to take advantage of that feature if possible. Any ideas? -- RMC,CPA |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That was it. I had left off the "=" at the beginning of the rangename. How stupid of me, but many thanks to you for putting me back
on track. With regard to the relative referencing, that is just perfect as it is because I need to copy it across. Thanks much. -- RMC,CPA "Trevor Shuttleworth" wrote in message ... Try: Sub pasteformula() Range("D1").Formula = "=NetPounds" End Sub Be careful though because the range formula will be relative to the cell you were in when you created the Named Range Formula. For example, I tested your example in cell A1 with the formula =B1-B2. When I copied the formula to cell A6 it refers to =B6-B7. Regards Trevor "R. Choate" wrote in message ... No, what I'm referring to is where the formula itself has a "range name" instead of the normal case where a range name refers to cells on a worksheet. Lets say the formula is "=B1-B2" and the formula's name is "NetPounds". I want to paste my formula in various places and refer to it by its name, "NetPounds". To use your example, my code would look more like: Sub pasteformula() Range("D1").Formula = "NetPounds" End Sub Any ideas? Thanks! -- RMC,CPA "JulieD" wrote in message ... Hi is this what you're after Sub pasteformula() Range("D1").Formula = "=SUM(myname)" End Sub Cheers JulieD "R. Choate" wrote in message ... I want to paste a formula which has a defined name and does not exist in any cell on any worksheet before I paste it. I know that defined name formulas can be referred to by other formulas on a worksheet, but I want to paste the defined name formulas programmatically. I know that there are other ways to accomplish what I'm doing in my project without using the named formulas, but using them would be a lot cleaner for me and I want to take advantage of that feature if possible. Any ideas? -- RMC,CPA |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Run-time error '50290': Application-defined or object-defined erro | Excel Discussion (Misc queries) | |||
"User-defined type not defined" message in Excel | Excel Discussion (Misc queries) | |||
Application defined or Object defined error | Excel Programming | |||
Word.Document - user defined type not defined | Excel Programming | |||
1004 App - defined or object-defined error | Excel Programming |