|
| Macro help |
 |
Mon, 14 Jan 2008 10:41:02 -080 |
Hi There:
I would like my macro be relevant to any active page with out having to
indicate the page letter i.e. {If A6>0}{SelectBlock A6}
As apposed to {If B:A6>0}{SelectBlock A6}. So that the macro works
upon any active page and not just on the page the macro is written on.
Please help if you can.
Jeff
|
| Post Reply
|
| Re: Macro help |
 |
Mon, 14 Jan 2008 16:32:36 -080 |
Roy:
Thanks for your macro example, I have learned something new.
My macro has a lot of {If (cell address)...} commands but all refer
to the sheet where the insertion point resides.
Any ideas?
Jeff.
"lemoto" <ctech@corel.ca> wrote in message
news:VA.00004a02.000a4c0c@corel.ca...
>
> Jeff:
>> I would like my macro be relevant to any active page with out having
to
>> indicate the page letter i.e. {If A6>0}{SelectBlock A6}
>
> 3) Often, QP does this for you, relating any ColRow reference to the
> sheet where the insertion point resides. Where this is the case, you may
> then need where appropriate to specify the macro Sheet as the target. At
> least you know which sheet this will always be. Some macro commands
> always relate to the macro sheet, wherever the insertion point may be.
> One such is .
>
> It is not easy to compose a list of rules that will predict which sheet
> (macro or currently active) will be referred to by which command, as this
> snippet shows.
>
> Copy it to A:G1. Then with the cursor in any other Sheet, do
> Alt-F2, A:G1, [Enter].
>
> {Let C3, 46}
> {PutBlock 78, E7}
>
>
> --
> Good wishes!
> Roy Lewis
> C_Tech volunteer
> (UK)
>
>
|
| Post Reply
|
| Re: Macro help |
 |
Mon, 14 Jan 2008 20:40:52 GMT |
Jeff:
> I would like my macro be relevant to any active page with out having to
> indicate the page letter i.e. {If A6>0}{SelectBlock A6}
>
This needs extra code. Check out @PROPERTY().
@CELLPOINTER() will do just as well.
1) Before any macro Cell containing either function is reached, you need
to that Cell. It does not constantly update.
2) I find it simpler (!) to maintain the function Cell outside the macro
and refer to it using /two/ s and "automatic" macro commands.
Here is a snippet, which does not address your "other sheet"
objective,
but does show how to use 1) and 2) above. You can copy it from here and
Paste into QP at K1. Have a Column partfilled with l/case letters (with
or without numerals), put the cursor in the top Cell of the letter block,
do: Alt-F2, K1, [Enter]. Then l/c becomes u/c.
This example does not need two separate s because of the layout.
It is necessary to first the Function Cell and then the
automatic Cell.
@CELLPOINTER("TwoDaddress")
@@(K2)
@UPPER(K3)
{ReCalc K2..K6}
+"{BlockValues K4, "&K2&"}"
{ReCalc K2..K9}
+"{IF "&K2&"<>""""}{BRANCH
K5}"
--
Good wishes!
Roy Lewis
C_Tech volunteer
(UK)
|
| Post Reply
|
| Re: Macro help |
 |
Mon, 14 Jan 2008 21:38:09 GMT |
Jeff:
> I would like my macro be relevant to any active page with out having to
> indicate the page letter i.e. {If A6>0}{SelectBlock A6}
3) Often, QP does this for you, relating any ColRow reference to the
sheet where the insertion point resides. Where this is the case, you may
then need where appropriate to specify the macro Sheet as the target. At
least you know which sheet this will always be. Some macro commands
always relate to the macro sheet, wherever the insertion point may be.
One such is .
It is not easy to compose a list of rules that will predict which sheet
(macro or currently active) will be referred to by which command, as this
snippet shows.
Copy it to A:G1. Then with the cursor in any other Sheet, do
Alt-F2, A:G1, [Enter].
{Let C3, 46}
{PutBlock 78, E7}
--
Good wishes!
Roy Lewis
C_Tech volunteer
(UK)
|
| Post Reply
|
| Re: Macro help |
 |
Tue, 15 Jan 2008 14:07:53 GMT |
Jeff:
> My macro has a lot of {If (cell address)...} commands but all refer
>
> to the sheet where the insertion point resides.
Where that sort of action is required, and if the action is
progressive - running down a Col, across a Row, or both - I usually
have the macro take a note of the start point in some Cell, and then
use that Cell (or those Cells) to compose the address for each
iteration of the loop.
- increment counter Cell
- create address using the new value
- do whatever is needed
- if some text succeeds (maybe <>"") loop again
Is that the sort of routine you need?
Here is a snippet that uses IF.
The blank line is intentional.
Copy the five lines to A:G1.
Call the macro (as before) from any Cell in any Sheet.
(Ctrl-Z will restore the Cell contents.)
A pair of double quotes indicate and delimit a string.
Within double quotes, a near-universal convention uses a pair of
double quotes to indicate an actual single double quote.
In QP, you will find it much easier to compose and read these
commands if you switch to the font Courier or similar.
~ represents [Enter]
{ReCalc G2}
+"{IF
"&@PROPERTY("Active_Block.Selection")&"<>"
;"""}{BRANCH G5}"
itwasblank~
itwasnotblank~
--
Good wishes!
Roy Lewis
C_Tech volunteer
(UK)
|
| Post Reply
|
|
|
|
|
|
|
|
|
|