ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Populating a cell with concatenated text... (https://www.excelbanter.com/excel-programming/383868-populating-cell-concatenated-text.html)

Sam

Populating a cell with concatenated text...
 
I want to enter a combination text/cell value in a cell, but vba won't let
me. It expects the end of the statement. Example: Range("A5").Formula = _
"=Summary of "&Q1&" manual comparison."

.... where Range("Q1") could be "Current" or "MTD".

Any help would be appreciated.

Sam

Martin Fishlock

Populating a cell with concatenated text...
 
Sam:

Try:

You need to put the text in quotes:

Range("A5").Formula = _
"=""Summary of "" & Q1 & "" manual comparison."""

--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"Sam" wrote:

I want to enter a combination text/cell value in a cell, but vba won't let
me. It expects the end of the statement. Example: Range("A5").Formula = _
"=Summary of "&Q1&" manual comparison."

... where Range("Q1") could be "Current" or "MTD".

Any help would be appreciated.

Sam


Gord Dibben

Populating a cell with concatenated text...
 
Sam

Need a few more double quotes.

Range("A5").Formula = "=""Summary of "" & B1 & "" manual comparison."""


Gord Dibben MS Excel MVP


On Fri, 23 Feb 2007 16:35:00 -0800, Sam wrote:

I want to enter a combination text/cell value in a cell, but vba won't let
me. It expects the end of the statement. Example: Range("A5").Formula = _
"=Summary of "&Q1&" manual comparison."

... where Range("Q1") could be "Current" or "MTD".

Any help would be appreciated.

Sam




All times are GMT +1. The time now is 05:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com