Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default recovering linked values in macro

Hi,
Is there a way to recover the values of linked cells in formulas? For
instance, say that I have a macro that operates on the concatenate
function, taking the first argument and adding the phrase "the first
argument is: " before it. If say cell "A1" has the formula
"=CONCATENATE("hello ","world")" than it is easy for me to figure out
that the first argument is "hello " by using a command like
"wholeformula = Range("b16").formula". However, what if the "hello "
was in cell b2 so that the formula in A1 is
"=CONCATENATE(b2,"world")". Is there a way for me to look at cell A1
in VBA and recover "hello " instead of b2?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default recovering linked values in macro

Dim rng as Range
set rng = ActiveCell.DirectPrecedents
for each cell in rng
msgbox cell.address & ": " & cell.Value
Next

this only works for cells on the same worksheet.

--
Regards,
Tom Ogilvy


"Andrew Smith" wrote in message
om...
Hi,
Is there a way to recover the values of linked cells in formulas? For
instance, say that I have a macro that operates on the concatenate
function, taking the first argument and adding the phrase "the first
argument is: " before it. If say cell "A1" has the formula
"=CONCATENATE("hello ","world")" than it is easy for me to figure out
that the first argument is "hello " by using a command like
"wholeformula = Range("b16").formula". However, what if the "hello "
was in cell b2 so that the formula in A1 is
"=CONCATENATE(b2,"world")". Is there a way for me to look at cell A1
in VBA and recover "hello " instead of b2?

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default recovering linked values in macro

Thanks Tom!
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
Paste Values in linked Cells Only Bean Counter[_2_] Excel Discussion (Misc queries) 4 June 2nd 10 05:40 PM
Linked values not updating James Excel Worksheet Functions 3 June 26th 06 12:42 AM
Replacing Linked Cell Values w/ Current Values TomCat Excel Worksheet Functions 6 April 10th 06 12:20 PM
linked values in other sheets Boon8888 Excel Discussion (Misc queries) 3 February 13th 06 09:08 PM
linked values in a chart Bill H. Charts and Charting in Excel 2 January 2nd 05 05:29 AM


All times are GMT +1. The time now is 05:21 PM.

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"