Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default Extracting formula instead of result from cell

Try:

Debug.Print Range("A1").Formula

Hope this helps
Rowan

lithium81 wrote:
Hi,

Is it possible to get the forumla from a cell instead of a the result
of the forumla using VBA/Macros?

e.g. In cell A1 I have the formula B1+C1.

I want to retrieve this formula and furthermore it wud be great if I
could get the values in B1 and C1, but I think once the formula can be
extracted, the rest will be easy.

Thanks!!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Extracting formula instead of result from cell


Hi,

Is it possible to get the forumla from a cell instead of a the result
of the forumla using VBA/Macros?

e.g. In cell A1 I have the formula B1+C1.

I want to retrieve this formula and furthermore it wud be great if I
could get the values in B1 and C1, but I think once the formula can be
extracted, the rest will be easy.

Thanks!!


--
lithium81
------------------------------------------------------------------------
lithium81's Profile: http://www.excelforum.com/member.php...o&userid=29461
View this thread: http://www.excelforum.com/showthread...hreadid=494029

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default Extracting formula instead of result from cell

If you want it in a variable then:

dim strFml as string
strFml = range("A1").formula

Regards
Rowan

lithium81 wrote:
Hi,

Thanks! When I do the debug.print, I don't see any output, perhaps I am
using it the wrong way. Could someone help please?

Will this put the data into a variable?

Thanks!


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Extracting formula instead of result from cell


Hi,

Thanks! When I do the debug.print, I don't see any output, perhaps I am
using it the wrong way. Could someone help please?

Will this put the data into a variable?

Thanks!


--
lithium81
------------------------------------------------------------------------
lithium81's Profile: http://www.excelforum.com/member.php...o&userid=29461
View this thread: http://www.excelforum.com/showthread...hreadid=494029

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Extracting formula instead of result from cell


Thank you! That works great!


--
lithium81
------------------------------------------------------------------------
lithium81's Profile: http://www.excelforum.com/member.php...o&userid=29461
View this thread: http://www.excelforum.com/showthread...hreadid=494029



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default Extracting formula instead of result from cell

You're welcome.

lithium81 wrote:
Thank you! That works great!


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 903
Default Extracting formula instead of result from cell

Hi lithium81,
Debug statement results from VBA code appear on the Intermediate
window in the Visual Basic Editor (Ctrl+G).

For what you want I would suggest the use and flexibility of a
User Defined Function see GetFormula at
http://www.mvps.org/dmcritchie/excel...htm#getformula
if it is not obvious where the formula referenced actually is at,
then a variation GetFormulaD might work better for you.
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Rowan Drummond" wrote in message ...
If you want it in a variable then:

dim strFml as string
strFml = range("A1").formula

Regards
Rowan

lithium81 wrote:
Hi,

Thanks! When I do the debug.print, I don't see any output, perhaps I am
using it the wrong way. Could someone help please?

Will this put the data into a variable?

Thanks!




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
Formula for extracting numbers only from a cell antsml Excel Discussion (Misc queries) 1 October 29th 09 10:08 AM
Formula Bar F9 Result differs from cell result??? Aaron Excel Worksheet Functions 3 May 15th 08 06:32 PM
Advanced formula - Return result & Show Cell Reference of result Irv Excel Worksheet Functions 7 May 6th 06 03:36 AM
Cell doesn't show formula result - it shows formula (CTRL + ' doe. o0o0o0o Excel Worksheet Functions 6 November 19th 04 03:13 PM
Question: Cell formula or macro to write result of one cell to another cell Frederik Romanov Excel Programming 1 July 8th 03 03:03 PM


All times are GMT +1. The time now is 10:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"