Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Directly setting variable to formula

Hi everyone -

I'm trying to figure out a more direct way of assigning a value that is
derived from a formula to a variable rather than having to place the
formula on the worksheet first.

Example:

I have a text item in cell A1 on a worksheet. I'm extracting a portion
of that text. Right now I'm doing this by assigning another cell to
this value using:

ActiveCell.FormulaR1C1 = "=LEFT(R1C1,FIND(""Accounts"",R1C1)-2)"
tVal = ActiveCell.Value

Is there someway to skip assigning a cell this formula and move the
value directly into tVal?

As a follow-up. Is there a quick way to load that tVal into each
location of a 1-D array of length n?

Thanks in advance

Marston

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Directly setting variable to formula

Try

Evaluate("=LEFT(A1,FIND(""Accounts"",A1)-2)")

--

HTH

RP
(remove nothere from the email address if mailing direct)


" wrote in message
ups.com...
Hi everyone -

I'm trying to figure out a more direct way of assigning a value that is
derived from a formula to a variable rather than having to place the
formula on the worksheet first.

Example:

I have a text item in cell A1 on a worksheet. I'm extracting a portion
of that text. Right now I'm doing this by assigning another cell to
this value using:

ActiveCell.FormulaR1C1 = "=LEFT(R1C1,FIND(""Accounts"",R1C1)-2)"
tVal = ActiveCell.Value

Is there someway to skip assigning a cell this formula and move the
value directly into tVal?

As a follow-up. Is there a quick way to load that tVal into each
location of a 1-D array of length n?

Thanks in advance

Marston



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
Userform button setting variable from formula teepee Excel Discussion (Misc queries) 4 January 4th 06 06:59 PM
Userform button setting variable from formula teepee Excel Discussion (Misc queries) 0 January 3rd 06 08:26 PM
Setting variable = to sheet name Jeff Armstrong Excel Programming 2 July 26th 04 08:57 PM
setting a range variable equal to the value of a string variable Pilgrim Excel Programming 2 July 1st 04 11:32 PM


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