combining content from an input box with existing cell content

  • Thread starter Thread starter Colin Hayes
  • Start date Start date
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.
 
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.
 
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
 
Back
Top