PC Review


Reply
Thread Tools Rate Thread

combining text and variable in a .value

 
 
Matthew Dyer
Guest
Posts: n/a
 
      8th Oct 2009
First, I want to thank everyone for all their help throughout today. I
appreciate it more than you can imagine!

I want my macro to output the text "Max DPD=" and the value of the
variable of Maxdpd all in the cell K3. This is what I've attempted,
but of course it doesn't work. Why not? How can I get it to work?

Range("k3").Value = "Max DPD=" + Maxdpd
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      8th Oct 2009
+ means to add numbers.
& means to concatenate strings

Sometimes VBA will forgive you and allow you to use + if it can guess (not
always correctly) what you want to do.

I'd try:

Range("k3").Value = "Max DPD=" & Maxdpd

If that doesn't work, you'll want to be more descriptive of how it fails.

Matthew Dyer wrote:
>
> First, I want to thank everyone for all their help throughout today. I
> appreciate it more than you can imagine!
>
> I want my macro to output the text "Max DPD=" and the value of the
> variable of Maxdpd all in the cell K3. This is what I've attempted,
> but of course it doesn't work. Why not? How can I get it to work?
>
> Range("k3").Value = "Max DPD=" + Maxdpd


--

Dave Peterson
 
Reply With Quote
 
Matthew Dyer
Guest
Posts: n/a
 
      8th Oct 2009
On Oct 7, 6:23*pm, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> + means to add numbers.
> & means to concatenate strings
>
> Sometimes VBA will forgive you and allow you to use + if it can guess (not
> always correctly) what you want to do.
>
> I'd try:
>
> Range("k3").Value = "Max DPD=" & Maxdpd
>
> If that doesn't work, you'll want to be more descriptive of how it fails.
>
> Matthew Dyer wrote:
>
> > First, I want to thank everyone for all their help throughout today. I
> > appreciate it more than you can imagine!

>
> > I want my macro to output the text "Max DPD=" and the value of the
> > variable of Maxdpd all in the cell K3. This is what I've attempted,
> > but of course it doesn't work. Why not? How can I get it to work?

>
> > Range("k3").Value = "Max DPD=" + Maxdpd

>
> --
>
> Dave Peterson


Dave Peterson to the rescue... AGAIN! Thanks for all your help!
 
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
Combining Variable Sized Ranges Joe Microsoft Excel Programming 0 25th Nov 2008 02:42 PM
Combining sheets with variable layout glyn@amethystmailing.co.uk Microsoft Excel Programming 4 14th Mar 2008 11:17 AM
Combining Text to Produce a Variable Name =?Utf-8?B?VmljV2VzdFZhbg==?= Microsoft Excel Programming 3 15th Aug 2006 03:49 AM
need some help combining a variable Gary Keramidas Microsoft Excel Programming 7 5th Jul 2005 02:51 PM
Combining variable names Bernie Gaile Microsoft Excel Programming 2 28th Dec 2003 09:24 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:41 PM.