Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #12  
Old 06-29-2018, 11:11 AM
d4okeefe d4okeefe is offline Extract List of terms and combine on a Table Windows 10 Extract List of terms and combine on a Table Office 2016
Advanced Beginner
 
Join Date: Apr 2013
Posts: 77
d4okeefe is on a distinguished road
Default

To get the text into two columns, you can do something like this. Notice that variables arr1 and arr2 already need to be filled with your data.

I hope that helps. Better yet, as I mentioned, it might be good to see your code. Since you aren't terribly used to working with VBA, it would be easy to have a variable misnamed or out of place.

Code:
    Dim tbl As Table
    Set tbl = new_doc_rng.Tables.Add(new_doc_rng, 2, 2)
    
    tbl.Cell(1, 1).Range.Text = "Countries from Doc1:"
    tbl.Cell(1, 2).Range.Text = "Countries from Doc2:"
    
    Dim countries1_as_string As String
    For x = 1 To UBound(arr1)
        If arr1(x) <> "" Then
            countries1_as_string = _
                countries1_as_string & arr1(x) & Chr(10)
        End If
    Next x
    tbl.Cell(2, 1).Range.Text = countries1_as_string
    
    Dim countries2_as_string As String
    For x = 1 To UBound(arr1)
        If arr1(x) <> "" Then
            countries2_as_string = _
                countries2_as_string & arr2(x) & Chr(10)
        End If
    Next x
    tbl.Cell(2, 2).Range.Text = countries2_as_string
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract List of terms and combine on a Table Need macro to make list of "defined terms" glnz Word VBA 8 09-07-2022 02:09 PM
How to extract names from a list flyoverrunner Excel 3 06-06-2018 04:54 AM
Extract List of terms and combine on a Table Best Practice for Indexing Multiple Word Terms and Sub-Terms jhy001 Word 4 11-06-2017 02:08 PM
Extract List of terms and combine on a Table How to Combine a Table of Contents Page with Another Document Dante49 Word 2 10-24-2016 01:53 PM
Extract List of terms and combine on a Table Need to extract two word domains from a list (BULK) Maxwell314 Excel 3 12-08-2014 06:17 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:30 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft