+ Reply to Thread
Results 1 to 3 of 3

Combining values in a range and converting to single string variable

Hybrid View

beat Combining values in a range... 01-30-2014, 08:01 AM
Olly Re: Combining values in a... 01-30-2014, 08:26 AM
beat [SOLVED] Re: Combining values... 01-30-2014, 10:46 AM
  1. #1
    Registered User
    Join Date
    10-20-2011
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    98

    Combining values in a range and converting to single string variable

    Hi,

    Lets say i have different text values in range A1 to A10

    I want to convert those values to a single string variable

    eg

    dim Combinedwords as string
    
    Combinedwords = Range("A1:A10").value
    Obviously that example doesnt work.

    Thanks for any help you can provide.

    Beat

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Combining values in a range and converting to single string variable

    Try:
    Sub foo()
    Dim Combinedwords As String, c As Range
    For Each c In Range("A1:A10")
        Combinedwords = Combinedwords & c.Value
    Next c
    Debug.Print Combinedwords
    End Sub
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    10-20-2011
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    98

    [SOLVED] Re: Combining values in a range and converting to single string variable

    Thanks thats perfect

+ 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. Replies: 5
    Last Post: 11-08-2012, 03:38 PM
  2. Replies: 7
    Last Post: 03-29-2012, 01:25 PM
  3. Replies: 3
    Last Post: 03-28-2012, 05:59 PM
  4. Combining Multiple Range Values into a Single Array
    By fervorking in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-19-2011, 10:26 AM
  5. Replies: 3
    Last Post: 02-14-2009, 02:16 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