Groups > WordPerfect Office > QuattroPro X3 > Re: Macro: copying 2 cells' content into 1




Macro: copying 2 cells' content into 1

Macro: copying 2 cells' content into 1
Mon, 14 Apr 2008 11:47:20 -040
I'm trying to get a macro to copy two cells' content into one.  I've 
tried recording the macro, but it only record "Put text XXX", wich 
obviously isn't right, since the contenct is subject to change.

The formulas are not the same, but just so you can understand what I mean:
Cell A:A1: @sum(F1..F10)   ==>result displayed 10'
Cell A:A2: @sum(E1..F10)   ==>result displayed 100'

I'd then need make it so that:
B:A1:  100' x 10'   (text format, for display only, no more calculations 
needed).

The only thing I could do is to make it so I will always have " 100' x 
10' " displayed, instead of the varying results the next time I need the 
macro.

What I did with the macro was to copy and paste the value in two 
different cells, then have the macro merge it in one by copy/paste, but 
I don't know enough about QP's macro to make it work.

Any help would be appreciated, thanks :)

QP X3 v. 13.0.0.565 (english)


Steve
Post Reply
Re: Macro: copying 2 cells' content into 1
Mon, 14 Apr 2008 11:56:32 -050
Use named ranges and you won't need to change ranges in your formulas.
A:A1: @sum(F1..F10)*@sum(E1..F10)
with named ranges
A:A1: @sum(Range1)*@sum(Range2)

Post Reply
Re: Macro: copying 2 cells' content into 1
Mon, 14 Apr 2008 12:27:36 -060
Steve Lemieux wrote:
> I'm trying to get a macro to copy two cells' content into one.  I've 
> tried recording the macro, but it only record "Put text XXX",
wich 
> obviously isn't right, since the contenct is subject to change.
> 
> The formulas are not the same, but just so you can understand what I mean:
> Cell A:A1: @sum(F1..F10)   ==>result displayed 10'
> Cell A:A2: @sum(E1..F10)   ==>result displayed 100'
> 
> I'd then need make it so that:
> B:A1:  100' x 10'   (text format, for display only, no more calculations 
> needed).
> 
> The only thing I could do is to make it so I will always have " 100' x

> 10' " displayed, instead of the varying results the next time I need
the 
> macro.
> 
> What I did with the macro was to copy and paste the value in two 
> different cells, then have the macro merge it in one by copy/paste, but 
> I don't know enough about QP's macro to make it work.

The string functions @FIXED or @STRING will produce the desired output WITHOUT 
use of a macro, but the simplest method takes advantage of the unique ability of

the @CONCATENATE function to string together values and labels, i.e.:

B:A1:  @CONCATENATE(A:A1," x ",A:A2)

Cheers,
Uli
Post Reply
Re: Macro: copying 2 cells' content into 1
Mon, 14 Apr 2008 13:28:34 -050
There are two methods to build strings, & and @Concatenate.  One method 
works better than the other sometimes.  For numbers, you will need to 
convert them to strings sometimes using @String.

Using a static string:
e.g.
{PutBlock +"'"&@String(A:A2,0)&"' X
"&@String(A:A1,0)&"'",B:A1}
Post Reply
Re: Macro: copying 2 cells' content into 1
Mon, 14 Apr 2008 13:48:27 -040
I don't think we understand one another, sorry if I was unclear.

Say, formula cell A:A1 give me a result, 12'
Formula cell A:A2 give me another result 100'

These are dimensions, and I'd like to report them to another sheet so it 
will look like this:
B: A1 100' x 12'

Even if I name A1: height and A2: diameter
these values are subject to change.

This is my bidding spreadsheet, the values in cells A:A1 and A:A2 will 
change with each different project; what I do is that once my 
calculations are done, I transfer them via a macro to another sheet, 
specific to the project (say 'B' ).

Currently, my macro does everything, except the size (100' x 12' in this 
case), wich I have to do manually.

I'm trying to find a way to copy these values so that in my project 
sheet it will look like:
100' x 12'
instead of me typing it manually.

I only want the displayed result of the formula, not the actual formula 
in sheet B, cell A1  (B: A1)

These values must stay as they are and not alway report the value of my 
calculations sheet (A) as they will change with each & every project.

The actual process I want to replicate would be similar to this:
{SelectBlock diameter}
{SelectBlock B:A1}
{PasteSpecial Properties;Formula cells;Label cells;Number cells;Formula 
values}
{SelectBlock height}
{SelectBlock B:A2}
{PasteSpecial Properties;Formula cells;Label cells;Number cells;Formula 
values}
{SelectBlock B:A2}{PutCell2 "130 x 12'"}
{Setproperty "Font.Bold";Yes}

I just recored it so it doesn't look very nice, but I think it describes 
my process.

B:A2 contains the info I need, for descriptive purposes.
I want it to remain the same over time, as the original cells (diameter 
& height) changes.  So I can't just point to the range.

I can of course type the value each time myself (100' x 12', 130' x 12').

I also need to add the ' to indicate it's feet :)


Am I clearer now?


Steve


Kenneth Hobson wrote:
> 
> Use named ranges and you won't need to change ranges in your formulas.
> A:A1: @sum(F1..F10)*@sum(E1..F10)
> with named ranges
> A:A1: @sum(Range1)*@sum(Range2)
> 
> 
Post Reply
<< Previous 1 2 Next >>
( Page 1 of 2 )
about | contact