🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac.apps
Article #3266

Re: help with Excel macro!

#3266
From: Art Parmet
Date: Fri, 15 Jun 1990 18:42
54 lines
2479 bytes
In article <24904@unix.cis.pitt.edu>, er225711@unix.cis.pitt.edu (Martin NMN Thurn) writes:
> I need help with (what I thought was going to be) a simple Excel macro.
> The part that doesn't work is: I have a =FOR loop, and I want to use the
> counter variable to reference rows/columns of a worksheet (active or macro,
> just so I can put my data _somewhere_!)  In other words, given (e.g.)
> =FOR("mycounter", 4, 18, 1)
> how can I use the value of "mycounter" in an "R1C1"-type expression within 
> the loop?  
>
>.....[ comments deleted ]

The solution to your problem is a feature of Excel called "Text Concatenation".
You are correct that it is not described in the manuals. However, it is
described in detail in a Microsoft Application Note by the same title.
(PS: The hot line support from Microsoft is responsive, courteous and quite
knowledgable !!!)

In short, concatenation allows you to use the ampersand (&) to join two or more
text values together to form a new text value.

For example, let's assume that you have a variable used as a counter which was
defined using:

=SET.NAME("My_Counter",1)

Assume the active cell points to some starting location of values.  To then use
"My_Counter" as an offset value:

=SELECT("R["&My_Counter&"]C[0]")

Concatenation can be useful for other imaginative things such as printing out
the values of variables in INPUT, MESSAGE and ALERT statements:

=MESSAGE(TRUE,"The Current Value of My_Counter is: "&My_Counter&"")

Another trick for formatting your interactive statements:

=SET.NAME("CR",CHAR(13))	ASCII Carriage Return - The MAC NEWLINE char

Then:

=ALERT("Warning- Current Value For My_Counter:"&CR&""&My_Counter&"",2)

Would result in an ALERT box (assume My_Counter has the value of 1234):

Warning- Current Value For My_Counter:
1234

Hope this helps.......

-- 
----
Art Parmet @ Motorola Semiconductor, Marlboro, Ma.
UUCP: {decvax, gatech!mcdchg}..!motbos!artp   Phone: +1 508-481-8100   
Technical Details
Message-ID: <669@motbos.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!oakhill!dover!mcdphx!mcdchg!mcdhup!mcdbos!motbos!artp
References: <24904@unix.cis.pitt.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!oakhill!dover!mcdphx!mcdchg!mcdhup!mcdbos!motbos!artp
From: artp@motbos.UUCP (Art Parmet)
Newsgroups: comp.sys.mac.apps
Subject: Re: help with Excel macro!
Summary: It's called "concatenation"
Keywords: excel,macro,HELP!
Message-ID: <669@motbos.UUCP>
Date: 15 Jun 90 18:42:20 GMT
References: <24904@unix.cis.pitt.edu>
Organization: Motorola Semiconductor Products, Marlboro, Ma.
Lines: 54