Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default cell contents


I have a cell that has a formula. The formula refrences other cells i
the sheet. I need some code that will give me the contents of a cell
select. I want it to give me the formula asigned to the cell.
Everything I have tried only gives me the value resulting from th
formula.

Ex: If a cell A1 contains "= B1+B2+B3"

I want to be able to call out this formula in come code, but I want i
to give me =B1+B2+B3, and not simple that it equals say

--
kola556
-----------------------------------------------------------------------
kola5567's Profile: http://www.excelforum.com/member.php...fo&userid=2461
View this thread: http://www.excelforum.com/showthread.php?threadid=39949

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default cell contents


To get the formula for active cells;

Sub ShowFormula()

MsgBox ActiveCell.Formula

End Su

--
hidek
-----------------------------------------------------------------------
hideki's Profile: http://www.excelforum.com/member.php...fo&userid=1890
View this thread: http://www.excelforum.com/showthread.php?threadid=39949

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default cell contents


how can i use the formula in the code. For instance if I want to refer
to the last cell in the formula in another calculation. In this case I
want to say look at the formula and whatever is the last cell referenced
in the formula copy that value or something like this.


--
kola5567
------------------------------------------------------------------------
kola5567's Profile: http://www.excelforum.com/member.php...o&userid=24614
View this thread: http://www.excelforum.com/showthread...hreadid=399493

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 683
Default cell contents

Here's an approach I use:

Function FormulaText(Ref As Range) As String
FormulaText = Ref.Cells(1).Formula
End Function

"kola5567" wrote:


I have a cell that has a formula. The formula refrences other cells in
the sheet. I need some code that will give me the contents of a cell I
select. I want it to give me the formula asigned to the cell.
Everything I have tried only gives me the value resulting from the
formula.

Ex: If a cell A1 contains "= B1+B2+B3"

I want to be able to call out this formula in come code, but I want it
to give me =B1+B2+B3, and not simple that it equals say 9


--
kola5567
------------------------------------------------------------------------
kola5567's Profile: http://www.excelforum.com/member.php...o&userid=24614
View this thread: http://www.excelforum.com/showthread...hreadid=399493


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
concatenate contents of cells whose contents resemble cell referem cathyh Excel Worksheet Functions 3 May 23rd 09 12:16 PM
nested Cell("contents", w/ cell contents reference) JASelep Excel Worksheet Functions 1 October 19th 07 12:17 AM
Macro to remove contents of cell and move all other contents up one row adw223 Excel Discussion (Misc queries) 1 July 1st 05 03:57 PM
Cell contents vs. Formula contents Sarah Excel Discussion (Misc queries) 3 December 15th 04 06:02 PM
Copying cell contents to add to existing contents in another cell Dean Sawas Excel Programming 3 April 2nd 04 09:00 PM


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