+ Reply to Thread
Results 1 to 8 of 8

VBA Concatenate

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    VBA Concatenate

    Hi, I wonder whether someone may be able to help me please.

    I'm trying to add a title to a particular cell, in this case cell B5, where the value is a combination of text and a cell value.

    I wasn't sure how to do this, but after searching various online pages I've come up with the code below:


     With Worksheets("All CTO Ending Assignments").Range("B5")
            .Resize(1, 5).Merge
            .ActiveCell.Formula = "=CONCATENATE(""B&C Flexible Resources With Assignments Ending 4 Weeks From "", (B3)))"
            .Cells(1, 1).Offset(2, 0).Resize(, 5).Value = Array("Staff Name", "Portfolio", "Project/Enhancement Name", "Forward View Ref", "Activity End Date")
        End With
    Unfortunately though, this isn't working, and I recieve an error on this line:

     .ActiveCell.Formula = "=CONCATENATE(""B&C Flexible Resources With Assignments Ending 4 Weeks From "", (B3)))"
    I just wondered whether someone may be able to look at this please and let me know where I've gone wrong.

    Many thanks and kind regards

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,320

    Re: VBA Concatenate

    Remove the .ActiveCell part and one of the closing parentheses. Do you actually want a formula in there, or a value?
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Concatenate

    Hi @romperstomper, thank you very much for taking the time to reply to my post.

    I'm actually wanting the value in the cell please.

    Many thanks and kind regards

    Chris

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,320

    Re: VBA Concatenate

    Then replace this:
    .ActiveCell.Formula = "=CONCATENATE(""B&C Flexible Resources With Assignments Ending 4 Weeks From "", (B3)))"
    with this:
    .Value = "B&C Flexible Resources With Assignments Ending 4 Weeks From " & Range("B3").Text
    I assumed you wanted the formatted value of B3. If not, use .Value rather than .Text at the end.

  5. #5
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Concatenate

    Hi @romperstomper, thank you very much for this, it works great.

    All the best and kind regards

    Chris

  6. #6
    Valued Forum Contributor Hawkeye16's Avatar
    Join Date
    02-27-2013
    Location
    Holland
    MS-Off Ver
    ├•┤ Pew Pew
    Posts
    441

    Re: VBA Concatenate

    nevermind, this is already answered
    Despite the high cost of living, it remains very popular.

    Don't forget to mark threads SOLVED when you get an answer and rep all the geniouses that helped you today!

  7. #7
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Concatenate

    Hi @Hawkeye, thank you for taking the time to come back to me with this. It is greatly appreciated.

    Kind regards

    Chris

  8. #8
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,320

    Re: VBA Concatenate

    Chris,
    Glad to help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. SUM of CONCATENATE
    By JaMeZ88007 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-21-2012, 04:53 AM
  2. Replies: 2
    Last Post: 04-12-2010, 12:35 PM
  3. Concatenate
    By Morrigan in forum Excel General
    Replies: 5
    Last Post: 05-24-2006, 06:04 PM
  4. CONCATENATE
    By mwlau in forum Excel General
    Replies: 2
    Last Post: 05-16-2006, 12:55 PM
  5. [SOLVED] I know how to concatenate ,can one de-concatenate to split date?
    By QUICK BOOKS PROBLEM- in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 07-26-2005, 01:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1