combining content from an input box with existing cell content

C

Colin Hayes

HI all

I'm struggling for syntax. I need to marry a variable with existing text
references.

I want to use the text I enter to an input box to replace the "<Monday>
" part of the code below.

ActiveCell.FormulaR1C1 = "=""<Monday> ""&RC[2]"


I'm setting up the input box this way :

openingtext = InputBox("Enter New Text")

and having entered my new text , I need to fit the variable openingtext
into the code above.

Can someone advise?

Grateful for any help.
 
J

Jim Cone

I think they are supposed to be a struggle. <g>...

openingtext = "<" & openingtext & "> "
ActiveCell.FormulaR1C1 = "=""" & openingtext & """&RC[2]"

-OR-

openingtext = "<" & openingtext & "> "
ActiveCell.Value = "=" & Chr$(34) & openingtext & Chr$(34) & "&RC[2]"
--
Jim Cone
Portland, Oregon USA
Review of Special Sort add-in at... http://www.contextures.com/excel-sort-addin.html

..
..
..

"Colin Hayes" <[email protected]>
wrote in message
HI all
I'm struggling for syntax. I need to marry a variable with existing text
references.
I want to use the text I enter to an input box to replace the "<Monday>
" part of the code below.

ActiveCell.FormulaR1C1 = "=""<Monday> ""&RC[2]"

I'm setting up the input box this way :
openingtext = InputBox("Enter New Text")
and having entered my new text , I need to fit the variable openingtext
into the code above.
Can someone advise?
Grateful for any help.
 
C

Colin Hayes

Jim Cone said:
I think they are supposed to be a struggle. <g>...

openingtext = "<" & openingtext & "> "
ActiveCell.FormulaR1C1 = "=""" & openingtext & """&RC[2]"

-OR-

openingtext = "<" & openingtext & "> "
ActiveCell.Value = "=" & Chr$(34) & openingtext & Chr$(34) & "&RC[2]"

Hi Jim

OK thanks for that. It worked perfectly first time.


I'm grateful for your time and expertise.


Best Wishes
 

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