PC Review


Reply
Thread Tools Rate Thread

Cocatenating two variables with a space in between

 
 
Deecrypt
Guest
Posts: n/a
 
      20th Dec 2006
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

 
Reply With Quote
 
 
 
 
Andy Pope
Guest
Posts: n/a
 
      20th Dec 2006
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
>

 
Reply With Quote
 
Bernie Deitrick
Guest
Posts: n/a
 
      20th Dec 2006
Khurrram,

ActiveCell.Value = userMonthName & " " & userYearName

HTH,
Bernie
MS Excel MVP


"Deecrypt" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
Deecrypt
Guest
Posts: n/a
 
      21st Dec 2006
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 there:
> 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
> >
> >


 
Reply With Quote
 
Deecrypt
Guest
Posts: n/a
 
      21st Dec 2006
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 there:
> 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
> >
> >


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What has priority: PATH from User variables or system variables? Sabine Elsner Windows XP Help 3 21st Oct 2008 02:42 PM
What has priority: PATH from User variables or system variables? Sabine Elsner Windows XP General 0 17th Oct 2008 06:46 PM
Session variables and static variables loss own contained value. neeraj Microsoft VB .NET 0 6th Sep 2006 01:33 PM
Passing Variable length Space Characters to Variables =?Utf-8?B?RXhjZWxNb25rZXk=?= Microsoft Excel Programming 5 7th Feb 2006 11:34 PM
User Environment variables overriden by system env variables Bonny Windows XP Setup 0 11th Jul 2003 06:01 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:53 PM.