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


hi folks,

my problem is the following: i want to rename a variable with a name
that could be entered as a parameter to the subroutine, a la:

sub addvariables(var1, var2, NameOfVar3)
var3 = var1 + var2
rename var3 as NameOfVar3 'pseudo-code!!!
sub end

how can i "rename" var3 into "NameOfVar3". i need the new name for
further referencing.

thanx in advance,
felix


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default rename a variable

Hi Felix,

What is it that you are trying to do? Maybe we can come up with a different
solution. I've never encountered a situation where I had to rename a
variable.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


qwerqtzui wrote:
hi folks,

my problem is the following: i want to rename a variable with a name
that could be entered as a parameter to the subroutine, a la:

sub addvariables(var1, var2, NameOfVar3)
var3 = var1 + var2
rename var3 as NameOfVar3 'pseudo-code!!!
sub end

how can i "rename" var3 into "NameOfVar3". i need the new name for
further referencing.

thanx in advance,
felix


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from
http://www.ExcelForum.com/


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA: rename a variable


Hi Jake,

I want to program a simple matrix addition that I can easily call
within vba. It should return the resulting matrix. Can you help me with
that?

Thanx,

Felix


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default VBA: rename a variable

Are the matrices in question in Excel ranges, or are they in memory (as
arrays)? If they are in ranges, you can do something like this:

1) Select the range that you would like the resulting matrix to be placed in
(must be same size as matrices to be added).

2) Type =, then select your first matrix, then type +, then select you
second matrix, and so on.

3) Use Ctrl+Shift+Enter to enter the formula (that lets Excel know it's an
array formula).

That should fill the selected range with the sum of the other matrices.

If the matrices are in memory, you'll have to loop through the elements of
each matrix and add them up. I think a search of groups.google.com would
assist you with this.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


qwerqtzui wrote:
Hi Jake,

I want to program a simple matrix addition that I can easily call
within vba. It should return the resulting matrix. Can you help me
with that?

Thanx,

Felix


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from
http://www.ExcelForum.com/


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
how do i rename a sheet if the rename tab is inactive? Nelson Excel Worksheet Functions 1 March 3rd 10 10:28 AM
Runtime Error '91' Object variable or With block variable not set Alec Coliver Excel Discussion (Misc queries) 2 October 24th 09 02:29 PM
variable height variable width stacked bar charts ambthiru Charts and Charting in Excel 3 January 18th 06 11:41 PM
Sum cells based on a row variable and seperate column variable CheeseHeadTransplant Excel Worksheet Functions 10 September 23rd 05 06:59 PM
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? Daniel Excel Worksheet Functions 1 July 9th 05 03:05 AM


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