Creating a sentence using macros

E

Edwin

Hi,

I have the following info in a worksheet:

A1 B1 C1
55KL 85.25 ER200

I would like to create a macro that would generate the following sentence in
cell A3:

55 85,25 200

Please note that the point in cell B1 was changed with a comma in the
sentence. I have a form with this setting repeating many times, so it would
be nice if the solution involves the active cell and the cells above it from
which the sentence is created instead of specific cell names. This is a
simplify version of what I really need to get done, but it has the basic idea
of what I’m trying to achieve.

Any guidance would be greatly appreciated.

Edwin
 
C

cm

Edwin,

This assumes that all of your values have the same format as your example,
and that there are single spaces between the 55 and 85 and between the 25 and
200.

=LEFT(A1,2)&" "&TEXT(TRUNC(B1),0)&","&TEXT((B1-TRUNC(B1))*100,0)&"
"&MID(C1,3,5)

Adjust the last '5' to however many characters after ER are possibly needed.
 
E

Edwin

Thanks cm, but I would like to do this with a macros only because I’ll have
many variations of the sentences depending on the input given; which means
that I will need to use more “IF†statements than a formula could handle.
 
R

roadkill

Without knowing what sort of variations you need to incorporate I don't see
how anyone could help. There must be some sort of rules governing what the
entries could look like in columns A, B, and C (and possibly others?) and
what the resulting sentence must look like for the various possibilities.
Will
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top