ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cocatenating two variables with a space in between (https://www.excelbanter.com/excel-programming/379793-cocatenating-two-variables-space-between.html)

Deecrypt

Cocatenating two variables with a space in between
 
The below code does not work but I think I just need a small tweek.
Simply want to display the values of two variables in the same cell but
with a space in between.


ActiveCell.FormulaR1C1 = "=CONCATENATE(" & userMonthName & " " &
userYearName & ")"

Kind regards
Khurram


Andy Pope

Cocatenating two variables with a space in between
 
Hi,

You need to double up on your quotes.

ActiveCell.FormulaR1C1 = "=CONCATENATE(" & userMonthName & _
""" """ & userYearName & ")"

Cheers
Andy

Deecrypt wrote:
The below code does not work but I think I just need a small tweek.
Simply want to display the values of two variables in the same cell but
with a space in between.


ActiveCell.FormulaR1C1 = "=CONCATENATE(" & userMonthName & " " &
userYearName & ")"

Kind regards
Khurram


Bernie Deitrick

Cocatenating two variables with a space in between
 
Khurrram,

ActiveCell.Value = userMonthName & " " & userYearName

HTH,
Bernie
MS Excel MVP


"Deecrypt" wrote in message
ps.com...
The below code does not work but I think I just need a small tweek.
Simply want to display the values of two variables in the same cell but
with a space in between.


ActiveCell.FormulaR1C1 = "=CONCATENATE(" & userMonthName & " " &
userYearName & ")"

Kind regards
Khurram




Deecrypt

Cocatenating two variables with a space in between
 
Thank you all
The double quoted idea didnt work, however thank you for pointing out
that a formula is not required and a simple .Value function could be
used. It works and I appreciate the help.

Cheers
Deecrypt

John Bundy wrote:

You don't have to place a formula the
Cells(1, 1) = "(" & userMonthname & " " & userYearname & ")"

check your other post as well
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Deecrypt" wrote:

The below code does not work but I think I just need a small tweek.
Simply want to display the values of two variables in the same cell but
with a space in between.


ActiveCell.FormulaR1C1 = "=CONCATENATE(" & userMonthName & " " &
userYearName & ")"

Kind regards
Khurram




Deecrypt

Cocatenating two variables with a space in between
 
Thank you all
The double quoted idea didnt work, however thank you for pointing out
that a formula is not required and a simple .Value function could be
used. It works and I appreciate the help.

Cheers
Deecrypt

John Bundy wrote:

You don't have to place a formula the
Cells(1, 1) = "(" & userMonthname & " " & userYearname & ")"

check your other post as well
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Deecrypt" wrote:

The below code does not work but I think I just need a small tweek.
Simply want to display the values of two variables in the same cell but
with a space in between.


ActiveCell.FormulaR1C1 = "=CONCATENATE(" & userMonthName & " " &
userYearName & ")"

Kind regards
Khurram





All times are GMT +1. The time now is 04:57 AM.

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