ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA: rename a variable (https://www.excelbanter.com/excel-programming/281570-vba-rename-variable.html)

qwerqtzui

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/


Jake Marx[_3_]

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/



qwerqtzui[_2_]

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/


Jake Marx[_3_]

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/




All times are GMT +1. The time now is 01:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com