Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default Pasting formula with defined name

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default Pasting formula with defined name

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default Pasting formula with defined name

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Pasting formula with defined name

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default Pasting formula with defined name

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
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
Run-time error '50290': Application-defined or object-defined erro Macro button Excel Discussion (Misc queries) 1 March 12th 09 10:59 AM
"User-defined type not defined" message in Excel RW1946 Excel Discussion (Misc queries) 0 August 31st 05 12:14 PM
Application defined or Object defined error FJ Shepley & JM Pfohl Excel Programming 2 September 8th 04 03:17 AM
Word.Document - user defined type not defined jowatkins[_7_] Excel Programming 0 January 20th 04 08:46 AM
1004 App - defined or object-defined error Stan Plumber Excel Programming 2 October 2nd 03 01:52 AM


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